Selenium wait till Page loaded

How can i make that Selenium knows when the page is loaded and then do the next step ?

Jan123 Default Asked on June 18, 2015 in Selenium WebDriver.
Add Comment
1 Answer(s)

Try some thing like that
ExpectedCondition<Boolean> pageLoadCondition = new
ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver driver) {
return ((JavascriptExecutor)driver).executeScript(“return document.readyState”).equals(“complete”);
}
};
WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(pageLoadCondition);

victor Reviewer Answered on June 25, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.