Search in sources :

Example 6 with RealHtmlElementState

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

the class RealHtmlMultiSelectList method getValues.

/**
     * @return the selected values
     */
@Override
@PublicAtsApi
public String[] getValues() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement element = RealHtmlElementLocator.findElement(this);
    Select select = new Select(element);
    List<WebElement> selectedOptions = select.getAllSelectedOptions();
    String[] result = new String[selectedOptions.size()];
    int i = 0;
    for (WebElement selectedOption : selectedOptions) {
        result[i++] = selectedOption.getText();
    }
    return result;
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 7 with RealHtmlElementState

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

the class RealHtmlElement method rightClick.

/**
     * Simulate mouse right click action
     */
@Override
@PublicAtsApi
public void rightClick() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement element = RealHtmlElementLocator.findElement(this);
    new Actions(webDriver).contextClick(element).perform();
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 8 with RealHtmlElementState

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

the class RealHtmlElement method pressEnterKey.

/**
     * Simulate Enter key
     */
@Override
@PublicAtsApi
public void pressEnterKey() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement element = RealHtmlElementLocator.findElement(this);
    if (webDriver instanceof PhantomJSDriver) {
        element.sendKeys(Keys.ENTER);
    } else {
        element.sendKeys(Keys.RETURN);
    }
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 9 with RealHtmlElementState

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

the class RealHtmlElement 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 RealHtmlElementState(this).waitToBecomeExisting();
    WebElement source = RealHtmlElementLocator.findElement(this);
    WebElement target = RealHtmlElementLocator.findElement(targetElement);
    Actions actionBuilder = new Actions(webDriver);
    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( webDriver ).dragAndDrop( source, target ).perform();
}
Also used : RealHtmlElementState(com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState) Action(org.openqa.selenium.interactions.Action) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 10 with RealHtmlElementState

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

the class RealHtmlElement method pressSpaceKey.

/**
     * Simulate Space key
     */
@Override
@PublicAtsApi
public void pressSpaceKey() {
    new RealHtmlElementState(this).waitToBecomeExisting();
    WebElement element = RealHtmlElementLocator.findElement(this);
    element.sendKeys(Keys.SPACE);
}
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