Search in sources :

Example 1 with RealHtmlElementState

use of com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState in project ats-framework by Axway.

the class AbstractRealBrowserDriver method handleExpectedPopups.

/**
	 * <b>Note:</b> For internal use only
	 */
public void handleExpectedPopups() {
    while (!expectedPopupsQueue.isEmpty()) {
        IExpectedPopup expectedPopup = expectedPopupsQueue.poll();
        if (expectedPopup instanceof ExpectedAlert) {
            ExpectedAlert expectedAlert = (ExpectedAlert) expectedPopup;
            new RealHtmlElementState(new RealHtmlAlert(this)).waitToBecomeExisting();
            Alert alert = getAlert();
            if (expectedAlert.expectedText != null && !expectedAlert.expectedText.equals(alert.getText())) {
                throw new VerificationException("The expected alert message was: '" + expectedAlert.expectedText + "', but actually it is: '" + alert.getText() + "'");
            }
            alert.accept();
        } else if (expectedPopup instanceof ExpectedPrompt) {
            ExpectedPrompt expectedPrompt = (ExpectedPrompt) expectedPopup;
            new RealHtmlElementState(new RealHtmlPrompt(this)).waitToBecomeExisting();
            Alert prompt = getAlert();
            if (expectedPrompt.expectedText != null && !expectedPrompt.expectedText.equals(prompt.getText())) {
                throw new VerificationException("The expected prompt text was: '" + expectedPrompt.expectedText + "', but actually it is: '" + prompt.getText() + "'");
            }
            if (expectedPrompt.clickOk) {
                prompt.sendKeys(expectedPrompt.promptValueToSet);
                prompt.accept();
            } else {
                prompt.dismiss();
            }
        } else if (expectedPopup instanceof ExpectedConfirm) {
            ExpectedConfirm expectedConfirm = (ExpectedConfirm) expectedPopup;
            new RealHtmlElementState(new RealHtmlConfirm(this)).waitToBecomeExisting();
            Alert confirm = getAlert();
            if (expectedConfirm.expectedText != null && !expectedConfirm.expectedText.equals(confirm.getText())) {
                throw new VerificationException("The expected confirmation message was: '" + expectedConfirm.expectedText + "', but actually it is: '" + confirm.getText() + "'");
            }
            if (expectedConfirm.clickOk) {
                confirm.accept();
            } else {
                confirm.dismiss();
            }
        }
        UiEngineUtilities.sleep();
    }
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) RealHtmlAlert(com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlAlert) ExpectedConfirm(com.axway.ats.uiengine.internal.realbrowser.ExpectedConfirm) RealHtmlConfirm(com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlConfirm) ExpectedAlert(com.axway.ats.uiengine.internal.realbrowser.ExpectedAlert) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) IExpectedPopup(com.axway.ats.uiengine.internal.realbrowser.IExpectedPopup) ExpectedAlert(com.axway.ats.uiengine.internal.realbrowser.ExpectedAlert) Alert(org.openqa.selenium.Alert) RealHtmlAlert(com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlAlert) RealHtmlPrompt(com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlPrompt) ExpectedPrompt(com.axway.ats.uiengine.internal.realbrowser.ExpectedPrompt)

Example 2 with RealHtmlElementState

use of com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState in project ats-framework by Axway.

the class RealHtmlFileBrowse method setValue.

/**
     * Set the File Select Button value
     *
     * @param value the value to set
     */
@Override
@PublicAtsApi
public void setValue(String value) {
    new RealHtmlElementState(this).waitToBecomeExisting();
    setFileInputValue(webDriver, value);
    UiEngineUtilities.sleep();
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 3 with RealHtmlElementState

use of com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState in project ats-framework by Axway.

the class RealHtmlSingleSelectList method getAllPossibleValues.

/**
     * @return  a list with all possible selection values
     */
@Override
@PublicAtsApi
public List<String> getAllPossibleValues() {
    List<String> values = new ArrayList<String>();
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement element = RealHtmlElementLocator.findElement(this);
    Select select = new Select(element);
    Iterator<WebElement> iterator = select.getOptions().iterator();
    if (!select.getAllSelectedOptions().isEmpty()) {
        while (iterator.hasNext()) {
            values.add(iterator.next().getText());
        }
        return values;
    }
    throw new SeleniumOperationException("There is no selectable 'option' in " + this.toString());
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) ArrayList(java.util.ArrayList) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 4 with RealHtmlElementState

use of com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState in project ats-framework by Axway.

the class RealHtmlCheckBox method check.

/**
	 * Check the check box
	 */
@Override
@PublicAtsApi
public void check() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement checkBoxElement = RealHtmlElementLocator.findElement(this);
    if (!checkBoxElement.isEnabled()) {
        throw new UnsupportedOperationException("You may not check a disabled element." + toString());
    }
    if (!checkBoxElement.isSelected()) {
        checkBoxElement.click();
    }
    UiEngineUtilities.sleep();
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 5 with RealHtmlElementState

use of com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState in project ats-framework by Axway.

the class RealHtmlCheckBox method isChecked.

/**
	 * Tells whether the check box is checked
	 */
@Override
@PublicAtsApi
public boolean isChecked() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement checkBoxElement = RealHtmlElementLocator.findElement(this);
    return checkBoxElement.isSelected();
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)34 PublicAtsApi (com.axway.ats.common.PublicAtsApi)31 WebElement (org.openqa.selenium.WebElement)30 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)7 Select (org.openqa.selenium.support.ui.Select)6 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)4 Actions (org.openqa.selenium.interactions.Actions)4 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)4 AbstractRealBrowserDriver (com.axway.ats.uiengine.AbstractRealBrowserDriver)2 NoSuchElementException (org.openqa.selenium.NoSuchElementException)2 RealHtmlAlert (com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlAlert)1 RealHtmlConfirm (com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlConfirm)1 RealHtmlPrompt (com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlPrompt)1 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)1 VerifyEqualityException (com.axway.ats.uiengine.exceptions.VerifyEqualityException)1 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)1 ExpectedAlert (com.axway.ats.uiengine.internal.realbrowser.ExpectedAlert)1 ExpectedConfirm (com.axway.ats.uiengine.internal.realbrowser.ExpectedConfirm)1 ExpectedPrompt (com.axway.ats.uiengine.internal.realbrowser.ExpectedPrompt)1 IExpectedPopup (com.axway.ats.uiengine.internal.realbrowser.IExpectedPopup)1