Example usage for org.openqa.selenium.remote RemoteWebElement RemoteWebElement

List of usage examples for org.openqa.selenium.remote RemoteWebElement RemoteWebElement

Introduction

In this page you can find the example usage for org.openqa.selenium.remote RemoteWebElement RemoteWebElement.

Prototype

RemoteWebElement

Source Link

Usage

From source file:com.vaadin.testbench.TestBenchElementTest.java

@Test
public void elementsEquals() {
    RemoteWebElement webElement = new RemoteWebElement();
    webElement.setId("remote1");
    TestBenchElement element = TestBenchElement.wrapElement(webElement, null);
    TestBenchElement element2 = TestBenchElement.wrapElement(webElement, null);

    assertTrue(webElement.equals(webElement));
    assertTrue(element.equals(element));
    assertTrue(webElement.equals(element));
    assertTrue(element.equals(webElement));

    assertTrue(element.equals(element2));
    assertTrue(element2.equals(element));

}

From source file:com.vaadin.testbench.TestBenchElementTest.java

@Test
public void elementsHashCode() {
    RemoteWebElement webElement = new RemoteWebElement();
    webElement.setId("remote1");
    TestBenchElement element = TestBenchElement.wrapElement(webElement, null);

    HashSet<WebElement> elements = new HashSet<WebElement>();
    elements.add(webElement);/*w w  w.j  a va  2s.  c  o m*/
    elements.add(element);
    Assert.assertEquals(1, elements.size());

}

From source file:hu.traininfo.uitest.step.Steps.java

License:Open Source License

@Then("I should see $expectedPage page within $timeout seconds")
public void checkPageLoad(final String webpage, Integer timeout) {
    final String webpageUrl = getWebpageUrl(webpage);
    if (timeout == null) {
        timeout = DEFAULT_TIMEOUT_IN_SECONDS;
    }/*from  w ww  . ja va2  s .com*/
    WebDriverWait webDriverWait = new WebDriverWait(browser, timeout);
    webDriverWait.until(new Function<WebDriver, WebElement>() {
        // @Override
        public WebElement apply(WebDriver driver) {
            boolean expectedUrl = driver.getCurrentUrl().contains(webpageUrl);
            if (expectedUrl) {
                return new RemoteWebElement();
            }
            return null;
        }
    });
}

From source file:org.uiautomation.ios.client.uiamodels.impl.RemoteIOSObject.java

License:Apache License

/**
 * Uses reflection to instanciate a remote object implementing the correct interface.
 *
 * @return the object. If the object is UIAElementNil, return null for a simple object, an empty
 *         list for a UIAElementArray./*from   w ww . ja  v a2 s . com*/
 */
public static WebElement createObject(RemoteWebDriver driver, Map<String, Object> ro) {
    String ref = ro.get("ELEMENT").toString();

    String type = (String) ro.get("type");
    if (type != null) {
        String remoteObjectName = "org.uiautomation.ios.client.uiamodels.impl.Remote" + type;

        if ("UIAElementNil".equals(type)) {
            return null;
        }

        boolean isArray = false; // uiObject.has("length");

        Object[] args = null;
        Class<?>[] argsClass = null;

        if (isArray) {
            // args = new Object[] {driver, ref, uiObject.getInt("length")};
            // argsClass = new Class[] {RemoteIOSDriver.class, String.class,
            // Integer.class};
        } else {
            args = new Object[] { driver, ref };
            argsClass = new Class[] { RemoteWebDriver.class, String.class };
        }
        try {
            Class<?> clazz = Class.forName(remoteObjectName);
            Constructor<?> c = clazz.getConstructor(argsClass);
            Object o = c.newInstance(args);
            RemoteWebElement element = (RemoteWebElement) o;
            element.setFileDetector(driver.getFileDetector());
            element.setParent(driver);
            element.setId(ref);
            return (RemoteIOSObject) o;
        } catch (Exception e) {
            throw new WebDriverException("error casting", e);
        }
    } else {
        RemoteWebElement element = new RemoteWebElement();
        element.setFileDetector(driver.getFileDetector());
        element.setId(ref);
        element.setParent(driver);
        return element;
    }

}