0

So i want to wait until page load using Selenium.

This is my implementation:

public static boolean isPageLoad(String url) {
    try {
        new WebDriverWait(driver, 30).until(ExpectedConditions.urlToBe(url));
        return true;
    } catch (Exception ex) {
        return false;
    }
}

So do you think this should be enough or i need maybe to add another check for example search also the body tag ?

Guy
  • 46,488
  • 10
  • 44
  • 88
danny kob
  • 171
  • 1
  • 2
  • 12

1 Answers1

1

You can just set the pageLoadTimeout when initializing the WebDriver

WebDriver driver = new ChromeDriver();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
Guy
  • 46,488
  • 10
  • 44
  • 88