Search in sources :

Example 16 with HiddenHtmlElementState

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

the class HiddenHtmlMultiSelectList method getValues.

/**
     * @return the selected value
     */
@Override
@PublicAtsApi
public String[] getValues() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
    List<String> values = new ArrayList<String>();
    List<WebElement> optionElements = selectElement.findElements(By.tagName("option"));
    for (WebElement element : optionElements) {
        if (element.isSelected()) {
            values.add(element.getText());
        }
    }
    if (values.isEmpty()) {
        throw new SeleniumOperationException("There is no selected 'option' in " + this.toString());
    }
    return values.toArray(new String[0]);
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) HtmlUnitWebElement(org.openqa.selenium.htmlunit.HtmlUnitWebElement) ArrayList(java.util.ArrayList) 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 17 with HiddenHtmlElementState

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

the class HiddenHtmlMultiSelectList method unsetValue.

/**
     * unselect a value
     *
     * @param value the value to unselect
     */
@Override
@PublicAtsApi
public void unsetValue(String value) {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
    List<WebElement> optionElements = selectElement.findElements(By.tagName("option"));
    for (WebElement el : optionElements) {
        if (el.getText().equals(value)) {
            if (el.isSelected()) {
                ((HtmlUnitWebElement) el).click();
                UiEngineUtilities.sleep();
            }
            return;
        }
    }
    throw new SeleniumOperationException("Option with label '" + value + "' not found. (" + 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)

Example 18 with HiddenHtmlElementState

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

the class HiddenHtmlLink method click.

/**
     * Click the link
     */
@PublicAtsApi
public void click() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HiddenHtmlElementUtils.mouseClick(HiddenHtmlElementLocator.findElement(this));
    UiEngineUtilities.sleep();
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 19 with HiddenHtmlElementState

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

the class HiddenHtmlLink method clickAndDownloadFile.

/**
     * Click link and download file
     */
@PublicAtsApi
public void clickAndDownloadFile() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    new HiddenHtmlElement(uiDriver, new UiElementProperties().addProperty("xpath", properties.getInternalProperty(HtmlElementLocatorBuilder.PROPERTY_ELEMENT_LOCATOR))).clickAndDownloadFile();
    UiEngineUtilities.sleep();
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) UiElementProperties(com.axway.ats.uiengine.elements.UiElementProperties) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 20 with HiddenHtmlElementState

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

the class HiddenHtmlButton method click.

@Override
@PublicAtsApi
public void click() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HiddenHtmlElementUtils.mouseClick(HiddenHtmlElementLocator.findElement(this));
    UiEngineUtilities.sleep();
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) 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