这是有线问题!我导入的项目正在100%正常工作(几个月前)
今天我已经将其与依赖项一起导入,并且在
WebDriverWait

这是我的代码:

WebDriverWait driverWait = new WebDriverWait(driver, 10000);
driverWait.until(ExpectedConditions.presenceOfElementLocated(By.id("saveBut1")));//here's the issue


这是错误:

no suitable method found for until(ExpectedCondition<WebElement>)
    method FluentWait.until(Predicate<WebDriver>) is not applicable
      (argument mismatch; ExpectedCondition<WebElement> cannot be converted to Predicate<WebDriver>)
    method FluentWait.<V>until(Function<? super WebDriver,V>) is not applicable
      (cannot infer type-variable(s) V
        (argument mismatch; ExpectedCondition<WebElement> cannot be converted to Function<? super WebDriver,V>))
  where V,T are type-variables:
    V extends Object declared in method <V>until(Function<? super T,V>)
    T extends Object declared in class FluentWait


我使用Netbeans作为IDE,并使用它导出了项目(3个月前)

最佳答案

我也遇到了这个问题,而且这个问题是(如上面评论中所建议的)我缺少google guava库,这是ExpectedCondition所需要的。一旦将其添加到项目中,它就会按预期进行编译。

07-27 19:15