Search in sources :

Example 11 with HiddenHtmlElementState

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

the class HiddenHtmlTextArea method setValue.

/**
     * Set the Text Area value
     *
     * @param value
     */
@Override
@PublicAtsApi
public void setValue(String value) {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HtmlUnitWebElement element = HiddenHtmlElementLocator.findElement(this);
    element.clear();
    element.sendKeys(value);
    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 12 with HiddenHtmlElementState

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

the class HiddenHtmlTextBox method appendValue.

/**
     * Append text to the current content of a Text Box
     * 
     * @param value
     */
@PublicAtsApi
public void appendValue(String value) {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HtmlUnitWebElement element = HiddenHtmlElementLocator.findElement(this);
    element.sendKeys(value);
    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 13 with HiddenHtmlElementState

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

the class HiddenHtmlMultiSelectList method setValue.

/**
     * select a value
     *
     * @param value the value to select
     */
@Override
@PublicAtsApi
public void setValue(String value) {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    HtmlUnitWebElement selectElement = HiddenHtmlElementLocator.findElement(this);
    if (selectElement.getAttribute("multiple") == null) {
        throw new SeleniumOperationException("Not a multi-select. You may only add a selection to a select that supports multiple selections. (" + this.toString() + ")");
    }
    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) SeleniumOperationException(com.axway.ats.uiengine.exceptions.SeleniumOperationException) WebElement(org.openqa.selenium.WebElement) HtmlUnitWebElement(org.openqa.selenium.htmlunit.HtmlUnitWebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 14 with HiddenHtmlElementState

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

the class HiddenHtmlElement method dragAndDropTo.

/**
     * Drag and drop an element on top of other element
     * @param targetElement the target element
     */
@Override
@PublicAtsApi
public void dragAndDropTo(HtmlElement targetElement) {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    WebElement source = HiddenHtmlElementLocator.findElement(this);
    WebElement target = HiddenHtmlElementLocator.findElement(targetElement);
    Actions actionBuilder = new Actions(htmlUnitDriver);
    Action dragAndDropAction = actionBuilder.clickAndHold(source).moveToElement(target, 1, 1).release(target).build();
    dragAndDropAction.perform();
// drops the source element in the middle of the target, which in some cases is not doing drop on the right place
// new Actions( htmlUnitDriver ).dragAndDrop( source, target ).perform();
}
Also used : HiddenHtmlElementState(com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState) Action(org.openqa.selenium.interactions.Action) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 15 with HiddenHtmlElementState

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

the class HiddenHtmlElement method pressTabKey.

/**
     * Simulate Tab key
     */
@Override
@PublicAtsApi
public void pressTabKey() {
    new HiddenHtmlElementState(this).waitToBecomeExisting();
    WebElement element = HiddenHtmlElementLocator.findElement(this);
    new Actions(htmlUnitDriver).sendKeys(element, Keys.TAB).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)

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