public static ExpectedCondition < List < WebElement > > presenceOfAllElementsLocatedBy ( final By locator ) { return new ExpectedCondition < List < WebElement > > ( ) { @ Override public List < WebElement > apply ( WebDriver driver ) { List < WebElement > elements = driver . findElements ( locator ) ; return elements . size ( ) > 0 ? elements : null ; } @ Override public String toString ( ) { return "presence of any elements located by " + locator ; } } ; }
An expectation for checking that there is at least one element present on a web page .