Example usage for org.openqa.selenium By findElement

List of usage examples for org.openqa.selenium By findElement

Introduction

In this page you can find the example usage for org.openqa.selenium By findElement.

Prototype

public WebElement findElement(SearchContext context) 

Source Link

Document

Find a single element.

Usage

From source file:MobileElement.java

License:Apache License

public WebElement findElement(By by) {
    return by.findElement(this);
}

From source file:com.dukescript.impl.selenium.DomNodeWebElement.java

License:Open Source License

@Override
public WebElement findElement(final By by) {
    try {//from   www. j a  v  a 2  s  . c om
        final CountDownLatch countDownLatch = new CountDownLatch(1);
        final WebElement[] result = new WebElement[1];
        ctx.execute(new Runnable() {
            @Override
            public void run() {
                WebElement findElement = by.findElement(DomNodeWebElement.this);
                result[0] = findElement;
                countDownLatch.countDown();
            }
        });
        countDownLatch.await();
        return result[0];
    } catch (InterruptedException ex) {
        Logger.getLogger(WebDriverFX.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:com.dukescript.impl.selenium.DukeScriptBrowser.java

License:Open Source License

@Override
public WebElement findElement(final By by) {
    try {//w ww  .java  2 s. com
        final CountDownLatch countDownLatch = new CountDownLatch(1);
        final WebElement[] result = new WebElement[1];
        ctx.execute(new Runnable() {
            @Override
            public void run() {
                WebElement findElement = by.findElement(DukeScriptBrowser.this);
                result[0] = findElement;
                countDownLatch.countDown();
            }
        });
        countDownLatch.await();
        return result[0];
    } catch (InterruptedException ex) {
        Logger.getLogger(WebDriverFX.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:com.machinepublishers.jbrowserdriver.Element.java

License:Apache License

/**
 * {@inheritDoc}
 */
@Override
public WebElement findElement(By by) {
    return by.findElement(this);
}

From source file:com.machinepublishers.jbrowserdriver.ElementServer.java

License:Apache License

/**
 * {@inheritDoc}//from w  ww .j av a  2  s  .c o m
 */
@Override
public ElementServer findElement(By by) {
    return (ElementServer) by.findElement(this);
}

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

@Override
public WebElement findElement(By arg0) {
    if (arg0 instanceof ByVaadin) {
        return TestBenchElement.wrapElement(arg0.findElement(this), this);
    }//from w w w  . j  av a 2  s  . c  om
    return TestBenchElement.wrapElement(actualDriver.findElement(arg0), this);
}

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

@Override
public WebElement findElement(By by) {
    waitForVaadin();/*from  w w w. ja va2 s.  c  o  m*/
    if (by instanceof ByVaadin) {
        return wrapElement(by.findElement(this), getCommandExecutor());
    }
    return wrapElement(actualElement.findElement(by), getCommandExecutor());
}

From source file:org.apache.portals.pluto.demo.integration.test.Util.java

License:Apache License

public static void clearElement(WebDriver webDriver, WaitingAsserter waitingAsserter, By locator) {

    waitingAsserter.waitFor(and(visibilityOfElementLocated(locator), new ElementEnabled(locator)));
    locator.findElement(webDriver).clear();
}

From source file:org.apache.portals.pluto.demo.integration.test.Util.java

License:Apache License

public static void clickElement(WebDriver webDriver, WaitingAsserter waitingAsserter, By locator) {

    waitingAsserter.waitFor(and(visibilityOfElementLocated(locator), elementToBeClickable(locator)));
    locator.findElement(webDriver).click();
}

From source file:org.apache.portals.pluto.demo.integration.test.Util.java

License:Apache License

public static void sendKeysToElement(WebDriver webDriver, WaitingAsserter waitingAsserter,
        boolean clearBeforeSendingKeys, By locator, CharSequence... keys) {

    waitingAsserter.waitFor(and(visibilityOfElementLocated(locator), new ElementEnabled(locator)));

    if (clearBeforeSendingKeys) {
        clearElement(webDriver, waitingAsserter, locator);
    }//from  w  ww . ja v a  2  s .c o m

    locator.findElement(webDriver).sendKeys(keys);
}