0
public boolean WaitForPageToLoad(){   

final ExpectedCondition<Boolean> pageLoadCondition = new ExpectedCondition<Boolean>() {
        public Boolean apply(final WebDriver driver) {
            return ((JavascriptExecutor) driver).executeScript("return document.readyState").equals("complete");
        }
    };

    final WebDriverWait wait = new WebDriverWait(this.driver, this.defaultTimeoutinSeconds);
    final boolean IsPageLoad = wait.until(pageLoadCondition);

    if (!IsPageLoad) {
        log.logInfo("Page doesn't load after " + this.defaultTimeoutinSeconds + " seconds");
    }
    return IsPageLoad;
}

above code was working in selenium 2.53.1 but when I upgraded to Selenium 3.1.X, above code is not compatible. Plaese anyone convert above code to make it compatible with selenium 3. I am getting below error
The method until(Function) in the type FluentWait is not applicable for the arguments (new ExpectedCondition(){})

Ron
  • 43
  • 1
  • 1
  • 9
  • Possible duplicate of [wait.until(ExpectedConditions) doesnt work any more in selenium](http://stackoverflow.com/questions/42421148/wait-untilexpectedconditions-doesnt-work-any-more-in-selenium) – JeffC Apr 26 '17 at 16:11
  • Did you google the error? This has already been asked and answered several times. – JeffC Apr 26 '17 at 16:11

1 Answers1

0

This code works for me for Selenium3

driver = (new Driver(Driver.Browser.SAFARI)).getDriver();

driver.navigate().to("http://www.epochconverter.com/");

waitForLoad(driver);

static void  waitForLoad(WebDriver driver) {
    new WebDriverWait(driver, 50).until((ExpectedCondition<Boolean>) wd ->
    ((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete"));
}
Eugene
  • 1,865
  • 3
  • 21
  • 24