sequence

This article describes how to solve the Cannot Applied problem in WebDriverWait.

The problem

webDriverWait.until(ExpectedConditions.presenceOfElementLocated(By.className("ready")));Copy the code

Pom dependencies were upgraded and an error was reported while using this method

until (java.util.function.Function<? super org.openqa.selenium.WebDriver,java.lang.Object>) in FluentWait cannot be applied
to       (org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>)Copy the code

Their idea on the point into the function to see along while what problem, has been puzzled. The cause was later found to be an older version of Guava, which did not yet support generics. The poM was changed to make the delivery dependent on the old Version of Guava. Here we need to re-exclude to explicitly force the introduction of a new version of Guava

<dependency> <groupId>com.google.guava</groupId> <artifactId> <version>22.0</version> </dependency>Copy the code

And you’re done.

doc

  • FluentWait changes WebDriverWait().until(ExpectedCondition…) fails with java.lang.NoSuchMethodError #3606