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:org.senchalabs.gwt.gwtdriver.by.CheatingByChained.java

License:Apache License

@Override
public WebElement findElement(SearchContext context) {
    WebElement elt = null;//from w  ww  . jav a 2s .c o  m
    for (By by : bys) {
        if (elt == null) {
            elt = by.findElement(context);
        } else {
            elt = by.findElement(elt);
        }
        if (elt == null) {
            throw new NoSuchElementException("Cannot locate element using " + this);
        }
    }
    if (elt == null) {
        throw new NoSuchElementException("Cannot locate element using " + this);
    }
    return elt;
}

From source file:sandeep.kb.android.remote.android.AndroidWebDriver.java

License:Apache License

public WebElement findElement(By by) {
    long start = System.currentTimeMillis();
    while (true) {
        try {//from ww  w  .  j  a  v  a2s .com
            return by.findElement(findBy);
        } catch (NoSuchElementException e) {
            if (System.currentTimeMillis() - start > implicitWait) {
                throw e;
            }
            sleepQuietly(100);
        }
    }
}

From source file:sandeep.kb.android.remote.android.AndroidWebElement.java

License:Apache License

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