Search in sources :

Example 6 with AbstractRealBrowserDriver

use of com.axway.ats.uiengine.AbstractRealBrowserDriver in project ats-framework by Axway.

the class RealHtmlElementLocator method findElements.

public static List<WebElement> findElements(UiElement uiElement, String xpathSuffix, boolean verbose) {
    AbstractRealBrowserDriver browserDriver = (AbstractRealBrowserDriver) uiElement.getUiDriver();
    WebDriver webDriver = (WebDriver) browserDriver.getInternalObject(InternalObjectsEnum.WebDriver.name());
    HtmlNavigator.getInstance().navigateToFrame(webDriver, uiElement);
    String xpath = uiElement.getElementProperties().getInternalProperty(HtmlElementLocatorBuilder.PROPERTY_ELEMENT_LOCATOR);
    String css = uiElement.getElementProperty("_css");
    if (xpathSuffix != null) {
        xpath += xpathSuffix;
    }
    if (!StringUtils.isNullOrEmpty(css)) {
        return webDriver.findElements(By.cssSelector(css));
    } else {
        return webDriver.findElements(By.xpath(xpath));
    }
}
Also used : WebDriver(org.openqa.selenium.WebDriver) AbstractRealBrowserDriver(com.axway.ats.uiengine.AbstractRealBrowserDriver)

Example 7 with AbstractRealBrowserDriver

use of com.axway.ats.uiengine.AbstractRealBrowserDriver 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)

Aggregations

AbstractRealBrowserDriver (com.axway.ats.uiengine.AbstractRealBrowserDriver)7 PublicAtsApi (com.axway.ats.common.PublicAtsApi)3 WebDriver (org.openqa.selenium.WebDriver)3 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)2 File (java.io.File)2 WebElement (org.openqa.selenium.WebElement)2 LocalFileSystemOperations (com.axway.ats.core.filesystem.LocalFileSystemOperations)1 LocalProcessExecutor (com.axway.ats.core.process.LocalProcessExecutor)1 IProcessExecutor (com.axway.ats.core.process.model.IProcessExecutor)1 MobileDriver (com.axway.ats.uiengine.MobileDriver)1 ElementNotFoundException (com.axway.ats.uiengine.exceptions.ElementNotFoundException)1 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)1 RobotException (com.axway.ats.uiengine.exceptions.RobotException)1 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 ElementNotVisibleException (org.openqa.selenium.ElementNotVisibleException)1 TakesScreenshot (org.openqa.selenium.TakesScreenshot)1