Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
12.0k views
by

I am using WebDriver wait in my code. I upgraded my selenium library. I started to get below error.

The method until(Function<? super WebDriver,V>) in the type FluentWait<WebDriver> is not applicable for the arguments (new ExpectedCondition<WebElement>(){})

My sample code:

Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
       .withTimeout(30, SECONDS)
       .pollingEvery(5, SECONDS)
       .ignoring(NoSuchElementException.class);

   WebElement foo = wait.until(new Function<WebDriver, WebElement>() {
     public WebElement apply(WebDriver driver) {
       return driver.findElement(By.id("foo"));
     }

2 Answers

1 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

You will have to update Guava library to version 21 and your JDK to version 8.

Change log for WebDriver wait and FluentWait

v3.2.0
======
* Updated Guava to version 21 and started using Java 8 features. Users
  are recommended to update too.
* Remove deprecated `FluentWait.until(Predicate<?>)` method. This
  should make lambdas work properly with Wait instances now.
v3.1.0
======
* Update how the WebDriverException gathers system info. Resolves an
  issue with slow-downs on OS X Sierra
* Update Wait and FluentWait for Java 8. Requires an update to the
  latest guava version 21.0
0 like 0 dislike
by

I was facing the same error The method until(Function<? super WebDriver,V>) in the type FluentWait<WebDriver> is not applicable for the arguments (ExpectedCondition<Alert>)

Solution I did -  I had 3 libraries of guava 19, 21, 23 in my same project. so I went to build path & removed the 19 & 23 versions of Guava & click apply in configure build path & it has been solved.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...