question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: wait.until is not usable

See original GitHub issue

What 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:closed
  • Created a year ago
  • Comments:22 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
diemolcommented, May 26, 2022

Reading the comments in ExpectedCondition, I see:

// NB: this originally extended Guava's Function interface since Java didn't have one. To avoid code
// such as "com.google.common.base.Function condition = ExpectedConditions.elementFound(By);"
// breaking at compile time, we continue to extend Guava's Function interface.

I wonder how much users’ code we would break if we switch to the Java Function one.

0reactions
github-actions[bot]commented, Jul 9, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - explicit wait not working properly - Stack Overflow
Explicit wait is not woking in the below line diver is waiting for only 70 to 100 milliseconds and error is displayed as...
Read more >
Setup does not wait for installation to complete when
I am trying to install the VS2017 build tools automatically from a script and need to wait for the installation to complete before...
Read more >
ExtendableEvent.waitUntil() - Web APIs | MDN
waitUntil () method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful....
Read more >
Wait.until for invisibility of element located is not working ...
I am trying to wait until an element is invisible on the screen of my mobile iOS device; however it's not consistent. It's...
Read more >
What the Tech: Should you wait to update your iPhone to iOS ...
In previous updates, bugs have been responsible for some apps not working, devices working sluggishly, or the smartphone battery discharging ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found