public static Condition and ( String name , final Condition ... condition ) { return new Condition ( name ) { private Condition lastFailedCondition ; @ Override public boolean apply ( Driver driver , WebElement element ) { for ( Condition c : condition ) { if ( ! c . apply ( driver , element ) ) { lastFailedCondition = c ; return false ; } } return true ; } @ Override public String actualValue ( Driver driver , WebElement element ) { return lastFailedCondition == null ? null : lastFailedCondition . actualValue ( driver , element ) ; } @ Override public String toString ( ) { return lastFailedCondition == null ? super . toString ( ) : lastFailedCondition . toString ( ) ; } } ; }
Check if element matches ALL given conditions .