public void viewShouldNotShowElement ( String viewName , String elementName ) throws IllegalAccessException , InterruptedException { boolean pass = false ; long startOfLookup = System . currentTimeMillis ( ) ; int timeoutInMillies = getSeleniumManager ( ) . getTimeout ( ) * 1000 ; while ( ! pass ) { WebElement found = getElementFromReferencedView ( viewName , elementName ) ; try { pass = ! found . isDisplayed ( ) ; } catch ( NoSuchElementException e ) { pass = true ; } if ( ! pass ) { Thread . sleep ( 100 ) ; } if ( System . currentTimeMillis ( ) - startOfLookup > timeoutInMillies ) { String foundLocator = getElementLocatorFromReferencedView ( viewName , elementName ) ; fail ( "The element \"" + foundLocator + "\" referenced by \"" + elementName + "\" on view/page \"" + viewName + "\" is still found where it is not expected after " + getSeleniumManager ( ) . getTimeout ( ) + " seconds." ) ; break ; } } }
The referenced view should not show the element identified by elementName