0

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

“FluentWait 类型的 withTimeout(Duration) 方法不适用于参数 (int, TimeUnit)”

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

2 回答 2

1

这是现在正确的用法..

Wait wait = new FluentWait(driver).withTimeout(Duration.ofSeconds(30)).pollingEvery(Duration.ofSeconds(30))
                    .ignoring(NoSuchElementException.class);
于 2019-10-10T16:48:29.743 回答
0

我进行了搜索,以下代码对我有用

            Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
                .withTimeout(10, TimeUnit.SECONDS)
                .pollingEvery(2, TimeUnit.SECONDS)
                .ignoring(NoSuchElementException.class);
于 2020-06-11T14:35:13.003 回答