Search in sources :

Example 21 with HiddenHtmlElementState

use of com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState in project ats-framework by Axway.

the class HiddenHtmlCheckBox method unCheck.

/**
     * Uncheck the check box
     */
@Override
@PublicAtsApi
public void unCheck() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HtmlUnitWebElement element = HiddenHtmlElementLocator.findElement(this);
    if (!element.isEnabled()) {
        throw new UnsupportedOperationException("You may not uncheck a disabled element." + toString());
    }
    if (element.isSelected()) {
        element.click();
    }
    UiEngineUtilities.sleep();
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) HtmlUnitWebElement(org.openqa.selenium.htmlunit.HtmlUnitWebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 22 with HiddenHtmlElementState

use of com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState in project ats-framework by Axway.

the class HiddenHtmlElement method pressEnterKey.

/**
     * Simulate Enter key
     */
@Override
@PublicAtsApi
public void pressEnterKey() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    WebElement element = HiddenHtmlElementLocator.findElement(this);
    new Actions(htmlUnitDriver).sendKeys(element, "\r").perform();
//        new Actions( htmlUnitDriver ).sendKeys( element, Keys.RETURN ).perform();
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 23 with HiddenHtmlElementState

use of com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState in project ats-framework by Axway.

the class HiddenHtmlElement method doubleClick.

/**
     * Simulate mouse double click action
     */
@Override
@PublicAtsApi
public void doubleClick() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    WebElement element = HiddenHtmlElementLocator.findElement(this);
    new Actions(htmlUnitDriver).doubleClick(element).perform();
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 24 with HiddenHtmlElementState

use of com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState in project ats-framework by Axway.

the class HiddenHtmlSingleSelectList method getAllPossibleValues.

/**
     * @return  a list with all possible selection values
     */
@Override
@PublicAtsApi
public List<String> getAllPossibleValues() {
    List<String> values = new ArrayList<String>();
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
    List<WebElement> optionElements = selectElement.findElements(By.tagName("option"));
    if (optionElements.size() > 0) {
        for (WebElement element : optionElements) {
            values.add(element.getText());
        }
        return values;
    }
    throw new SeleniumOperationException("There is no selectable 'option' in " + this.toString());
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) ArrayList(java.util.ArrayList) HtmlUnitWebElement(org.openqa.selenium.htmlunit.HtmlUnitWebElement) WebElement(org.openqa.selenium.WebElement) HtmlUnitWebElement(org.openqa.selenium.htmlunit.HtmlUnitWebElement) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 25 with HiddenHtmlElementState

use of com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState in project ats-framework by Axway.

the class HiddenHtmlSingleSelectList method getValue.

/**
     * @return the single selection value
     */
@Override
@PublicAtsApi
public String getValue() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
    List<WebElement> optionElements = selectElement.findElements(By.tagName("option"));
    for (WebElement element : optionElements) {
        if (element.isSelected()) {
            return element.getText();
        }
    }
    throw new SeleniumOperationException("There is no selected 'option' in " + this.toString());
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) HtmlUnitWebElement(org.openqa.selenium.htmlunit.HtmlUnitWebElement) WebElement(org.openqa.selenium.WebElement) HtmlUnitWebElement(org.openqa.selenium.htmlunit.HtmlUnitWebElement) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)32 HiddenHtmlElementState (com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState)32 WebElement (org.openqa.selenium.WebElement)19 HtmlUnitWebElement (org.openqa.selenium.htmlunit.HtmlUnitWebElement)12 Actions (org.openqa.selenium.interactions.Actions)9 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)7 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)3 UiElementProperties (com.axway.ats.uiengine.elements.UiElementProperties)2 ArrayList (java.util.ArrayList)2 VerifyEqualityException (com.axway.ats.uiengine.exceptions.VerifyEqualityException)1 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)1 List (java.util.List)1 Action (org.openqa.selenium.interactions.Action)1