Search in sources :

Example 21 with RealHtmlElementState

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

the class RealHtmlRadioList method select.

/**
     * set the selected value
     *
     * @param value the value to select(this is the 'value' attribute of the radio button)
     */
@PublicAtsApi
public void select(String value) {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement element = RealHtmlElementLocator.findElement(this, "[@value='" + value + "']", true);
    if (!element.isEnabled()) {
        throw new UnsupportedOperationException("You may not select a disabled element." + toString());
    }
    element.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 22 with RealHtmlElementState

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

the class RealHtmlSingleSelectList method getValue.

/**
     * @return the single selection value
     */
@Override
@PublicAtsApi
public String getValue() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement element = RealHtmlElementLocator.findElement(this);
    Select select = new Select(element);
    if (!select.getAllSelectedOptions().isEmpty()) {
        return select.getFirstSelectedOption().getText();
    }
    throw new SeleniumOperationException("There is no selected 'option' in " + this.toString());
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) 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 23 with RealHtmlElementState

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

the class RealHtmlSingleSelectList method setValue.

/**
     * set the single selection value
     *
     * @param value the value to select
     */
@Override
@PublicAtsApi
public void setValue(String value) {
    new RealHtmlElementState(this).waitToBecomeExisting();
    try {
        WebElement element = RealHtmlElementLocator.findElement(this);
        Select select = new Select(element);
        select.selectByVisibleText(value);
    } catch (NoSuchElementException nsee) {
        throw new SeleniumOperationException("Option with label '" + value + "' not found. (" + this.toString() + ")");
    }
    UiEngineUtilities.sleep();
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) NoSuchElementException(org.openqa.selenium.NoSuchElementException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 24 with RealHtmlElementState

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

the class RealHtmlButton method doClick.

private void doClick() {
    try {
        new RealHtmlElementState(this).waitToBecomeExisting();
        WebElement element = RealHtmlElementLocator.findElement(this);
        try {
            element.click();
        } catch (ElementNotVisibleException enve) {
            if (!UiEngineConfigurator.getInstance().isWorkWithInvisibleElements()) {
                throw enve;
            }
            ((JavascriptExecutor) webDriver).executeScript("arguments[0].click()", element);
        }
    } catch (Exception e) {
        ((AbstractRealBrowserDriver) super.getUiDriver()).clearExpectedPopups();
        throw new SeleniumOperationException(this, "click", e);
    }
    UiEngineUtilities.sleep();
    ((AbstractRealBrowserDriver) super.getUiDriver()).handleExpectedPopups();
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) AbstractRealBrowserDriver(com.axway.ats.uiengine.AbstractRealBrowserDriver) WebElement(org.openqa.selenium.WebElement) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) ElementNotVisibleException(org.openqa.selenium.ElementNotVisibleException) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) ElementNotVisibleException(org.openqa.selenium.ElementNotVisibleException)

Example 25 with RealHtmlElementState

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

the class RealHtmlCheckBox method unCheck.

/**
	 * Uncheck the check box
	 */
@Override
@PublicAtsApi
public void unCheck() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement checkBoxElement = RealHtmlElementLocator.findElement(this);
    if (!checkBoxElement.isEnabled()) {
        throw new UnsupportedOperationException("You may not uncheck 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)

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