Created
June 2, 2014 10:17
-
-
Save azakordonets/62e7778bbb405fd4a0ce to your computer and use it in GitHub Desktop.
This method allows you to properly wait for page in load with WebDriver
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 waitForPageToLoad() { | |
| Wait<WebDriver> wait = new WebDriverWait(manager.getDriver(), 30); | |
| wait.until(new Function<WebDriver, Boolean>() { | |
| public Boolean apply(WebDriver driver) { | |
| System.out.println("Current Window State : " | |
| + String.valueOf(((JavascriptExecutor) driver).executeScript("return document.readyState"))); | |
| return String | |
| .valueOf(((JavascriptExecutor) driver).executeScript("return document.readyState")) | |
| .equals("complete"); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment