public static ExpectedCondition < Boolean > titleIs ( final String title ) { return new ExpectedCondition < Boolean > ( ) { private String currentTitle = "" ; @ Override public Boolean apply ( WebDriver driver ) { currentTitle = driver . getTitle ( ) ; return title . equals ( currentTitle ) ; } @ Override public String toString ( ) { return String . format ( "title to be \"%s\". Current title: \"%s\"" , title , currentTitle ) ; } } ; }
An expectation for checking the title of a page .