java - fluidwait<webdriver> 类型中的 withtimeout(duration) 方法不适用于参数 (int, timeunit)

标签 java maven selenium-webdriver fluentwait

使用此代码时出现错误,错误是

"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);

最佳答案

这是现在的正确用法..

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

关于java - fluidwait<webdriver> 类型中的 withtimeout(duration) 方法不适用于参数 (int, timeunit),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58327038/

相关文章:

java - Java 1.7 中通过 WatchService 观察目录变化

maven - maven 构建中的未知主机异常 nexus.codehaus.org

java - 无法通过 Java selenium 单击表中的第一个元素

java - 我无法在单独的方法中访问我的变量

java - 当我打开相机时应用程序崩溃

java - 当 Java 需要这种链接约定时,为什么 Maven 在安装 native 库时会修剪 "lib"前缀?

javascript - 通过WebDriver在C#中执行Javascript文件

javascript - ruby 变量在 driver.execute_script 之后返回 nil

java - Spring Boot + WEB-INF

eclipse - Eclipse中的Maven插件-缺少Settings.xml文件