Search code examples
javaeclipseseleniumguava

How to update guava for Selenium Standalone Server


I had a working Code in Selenium. After updating Geckodriver and the Selenium Standalone Server the Webdriver wait.until() function didn't work anymore. So after using google I noticed I also have to update guava to version 23. In eclipse I imported this guava version into the project but the function is still not available. Does anyone has already experience with this problem or knows the solution?

Best Regards

Edit:

This is the ErrorMessage:

The method until(Function) in the type FluentWait is not applicable for the arguments (Predicate)

But I don't actually use FluentWait. I use WebDriverWait

void waitForPageLoad(double d){
    WebDriverWait wait = new WebDriverWait(this.driver, 10);

    Predicate<WebDriver> pageLoaded = new Predicate<WebDriver>(){
        @Override
        public boolean apply(WebDriver input){
            return ((JavascriptExecutor) input).executeScript("return document.readyState").equals("complete");
        }
    };
    try {
        Thread.sleep((long) (d*1000));
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    wait.until(pageLoaded);
}

Solution

  • void waitForPageLoad(double d){
            try {
                Thread.sleep((long) (d*1000));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            new WebDriverWait(this.driver, (long) (10000)).until(driver -> 
                    ((JavascriptExecutor) driver).executeScript("return document.readyState").equals("complete"));
        }
    

    I found this solution and it's working. So there is no more need to update Guava manually. They simply changed something in their Framework