public void attribute ( String attribute , String expectedValue , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; while ( ! expectedValue . equals ( element . get ( ) . attribute ( attribute ) ) && System . currentTimeMillis ( ) < end ) ; double timeTook = Math . min ( ( seconds * 1000 ) - ( end - System . currentTimeMillis ( ) ) , seconds * 1000 ) / 1000 ; checkAttribute ( attribute , expectedValue , seconds , timeTook ) ; } catch ( TimeoutException e ) { checkAttribute ( attribute , expectedValue , seconds , seconds ) ; } }
Waits for the element has an attribute with a value equals to the value provided . If the element isn t present or the element does not have the attribute this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a screenshot for traceability and added debugging support .