-
-
Save djangofan/cd96628f9ae2b4927c4d to your computer and use it in GitHub Desktop.
Predicate used in Selenium WebDriver wait
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void authenticate() { | |
this.authenticateButton.click(); | |
new WebDriverWait(driver, 30).until(authenticated()); | |
} | |
private Predicate<WebDriver> authenticated() { | |
return new Predicate<WebDriver>() { | |
@Override public boolean apply(WebDriver driver) { | |
return isAuthenticated(); | |
} | |
}; | |
} | |
//delegate method here | |
private boolean isAuthenticated() { | |
return (Boolean) executor().executeScript("return authenticated;"); | |
} | |
private JavascriptExecutor executor() { | |
return (JavascriptExecutor) driver; | |
} | |
http://howtodoinjava.com/2014/04/04/how-to-use-predicate-in-java-8/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment