[🐛 Bug]: wait.until is not usable
See original GitHub issueWhat happened?
My “wait.until” function worked fine yesterday, but all a sudden now is not runnable.
Error message: reason: no instance(s) of type variable(s) V exist so that ExpectedCondition<WebElement> conforms to Function<? super WebDriver, V>
I have looked it up online, and people said it is related to the inconsistent versions of Guava and Selenium. However, I have already checked my project structure, and there are no other extra versions of Guava and Selenium.
How can we reproduce the issue?
I am not sure how to reproduce since I don’t know what’s wrong. The only thing I can provide is what I am using. Sorry and thanks.
Please see my pom.xml below:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
The code I have run:
public void visibilityOfElementLocatedByXpath(String xpath){
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpath)));
}
In addition, I am using JAVA 17, maven project with IntelliJ IDEA with MacBook Air (M1,2020).
java: method until in class org.openqa.selenium.support.ui.FluentWait<T> cannot be applied to given types;
required: java.util.function.Function<? super org.openqa.selenium.WebDriver,V>
found: org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>
reason: cannot infer type-variable(s) V
(argument mismatch; org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement> cannot be converted to java.util.function.Function<? super org.openqa.selenium.WebDriver,V>)
Operating System
MacBook Air (M1,2020) - macOS Monterey 12.2.1
Selenium version
4.1.3
What are the browser(s) and version(s) where you see this issue?
Not-related
What are the browser driver(s) and version(s) where you see this issue?
Not-related
Are you using Selenium Grid?
No
Issue Analytics
- State:
- Created a year ago
- Comments:22 (18 by maintainers)
Top GitHub Comments
Reading the comments in
ExpectedCondition
, I see:I wonder how much users’ code we would break if we switch to the Java
Function
one.This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.