I have updated selenium dependency to 4.1.1 And in fluent wait object i am facing this error. my object code is:
FluentWait wait =new FluentWait(driver).withTimeout(30,TimeUnit.SECONDS).pollingEvery(5,TimeUnit.SECONDS).ignoring(org.openqa.selenium.NoSuchElementException.class);
Error is this: java: method withTimeout in class org.openqa.selenium.support.ui.FluentWait cannot be applied to given types; required: java.time.Duration found: int,java.util.concurrent.TimeUnit reason: actual and formal argument lists differ in length
As the error says, withTimeout
takes a Duration
argument. The same goes for pollingEvery
:
fluentWait wait =
new FluentWait<WebDriver>(driver)
.withTimeout(Duration.ofSeconds(30L))
.pollingEvery(Duration.ofSeconds(5L))
.ignoring(org.openqa.selenium.NoSuchElementException.class);
EDIT:
FWIW, the usage sample in the FluentWait
class refers to deprecated methods that no longer exist (IIUC, since 4.0.0). The fact that the sample usage was not updated accordingly is a bug.
I've file a bug on the project and issued a PR to fix it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.