protected void checkText ( PageElement pageElement , String textOrKey ) throws TechnicalException , FailureException { WebElement webElement = null ; String value = getTextOrKey ( textOrKey ) ; try { webElement = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageElement ) ) ) ; } catch ( final Exception e ) { new Result . Failure <> ( e . getMessage ( ) , Messages . getMessage ( Messages . FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT ) , true , pageElement . getPage ( ) . getCallBack ( ) ) ; } final String innerText = webElement == null ? null : webElement . getText ( ) ; logger . info ( "checkText() expected [{}] and found [{}]." , textOrKey . startsWith ( cryptoService . getPrefix ( ) ) ? SECURE_MASK : value , innerText ) ; if ( ! value . equals ( innerText ) ) { new Result . Failure <> ( innerText , Messages . format ( Messages . getMessage ( Messages . FAIL_MESSAGE_WRONG_EXPECTED_VALUE ) , pageElement , textOrKey . startsWith ( cryptoService . getPrefix ( ) ) ? SECURE_MASK : value , pageElement . getPage ( ) . getApplication ( ) ) , true , pageElement . getPage ( ) . getCallBack ( ) ) ; } }
Checks if HTML text contains expected value .