Search code examples
javamavenselenium-webdriverfluentwait

the method withtimeout(duration) in the type fluentwait<webdriver> is not applicable for the arguments (int, timeunit)


An error appear while working with this code the error is

"The method withTimeout(Duration) in the type FluentWait is not applicable for the arguments (int, TimeUnit)"

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

Solution

  • This is the correct usage now..

    Wait wait = new FluentWait(driver).withTimeout(Duration.ofSeconds(30)).pollingEvery(Duration.ofSeconds(30))
                        .ignoring(NoSuchElementException.class);