public WebElement find ( ) { checkState ( webDriver != null , "No WebDriver specified." ) ; checkState ( by != null , "No By instance for locating elements specified." ) ; if ( ! noLogging ) { log . info ( toString ( ) ) ; } WebElement element ; if ( timeoutSeconds > 0L ) { WebDriverWait wait = createWebDriverWait ( ) ; element = wait . until ( new Function < WebDriver , WebElement > ( ) { @ Override public WebElement apply ( final WebDriver input ) { WebElement el = input . findElement ( by ) ; checkElement ( el ) ; if ( condition != null && ! condition . apply ( el ) ) { throw new WebElementException ( String . format ( "Condition not met for element %s: %s" , el , condition ) ) ; } return el ; } @ Override public String toString ( ) { return WebElementFinder . this . toString ( ) ; } } ) ; } else { element = webDriver . findElement ( by ) ; checkElement ( element ) ; if ( condition != null && ! condition . apply ( element ) ) { throw new WebElementException ( String . format ( "Condition not met for element %s: %s" , element , condition ) ) ; } } return element ; }
Finds the first element .