public static ExpectedCondition < Boolean > invisibilityOfAllElements ( final List < WebElement > elements ) { return new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver webDriver ) { return elements . stream ( ) . allMatch ( ExpectedConditions :: isInvisible ) ; } @ Override public String toString ( ) { return "invisibility of all elements " + elements ; } } ; }
An expectation for checking all elements from given list to be invisible