public boolean verifyText ( final By by , final String text ) { WebElement element = driver . findElement ( by ) ; if ( element . getText ( ) . equals ( text ) ) { LOG . info ( "Element: " + element + " contains the given text: " + text ) ; return true ; } LOG . info ( "Element: " + element + " does NOT contain the given text: " + text ) ; return false ; }
Verifies that the given element contains the given text .