No instance(s) of type variable(s) V exist so that ExpectedCondition<Boolean> conforms to Function<? super WebDriver, V> error using Selenium 3.13.0

Viewed 1381

I have been using these 2 function in Selenium, they were working fine. Now they dont, there is an error saying:

No instance(s) of type variable(s) V exist so that ExpectedCondition<WebElement> conforms to Function<? super WebDriver, V>

I have not updated Selenium nor anything else in the project. What could be the cause?

worth mentioning, the function they both reside is:

public static void safeClick(WebDriver driver, WebElement element, Boolean checkVisibility) {
    JavascriptExecutor executor = (JavascriptExecutor) driver;
    executor.executeScript("arguments[0].scrollIntoView(true);", element);
    executor.executeScript("arguments[0].focus();", element);

    if (checkVisibility) {
      WebDriverWait wait = new WebDriverWait(driver, 5);
      wait.until(ExpectedConditions.visibilityOf(element));
      wait.until(ExpectedConditions.elementToBeClickable(element));
    }

   executor.executeScript("arguments[0].click();", element);
  }
1 Answers

This error message...

No instance(s) of type variable(s) V exist so that ExpectedCondition<Boolean> 
conforms to Function<? super WebDriver, V>

...implies that there is a mismatch between the Selenium client version and versions.

A bit more details about the Selenium client version and the Guava version you are using would have helped us to debug the issue in a better way.


Solution

Ensure the following combination of Selenium client version and the Guava version:

  • Selenium v3.12.0 : guava-23.6-jre
  • Selenium v3.13.0 : guava-25.0-jre
  • Selenium v3.14.0 : guava-25.0-jre
  • Selenium v3.141.0 : guava-25.0-jre
  • Selenium v3.141.5 : guava-25.0-jre
  • Selenium v3.141.59 : guava-25.0-jre

References

You can find a relevant detailed discussion in:

Related