selenium找不到合适的方法(ExpectedCondition <WebElement>)

Ham*_*daq 2 java selenium netbeans

这是有线问题!我导入的项目是100%工作(几个月前),今天我用依赖项导入了它,并且存在一个问题 WebDriverWait

这是我的代码:

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

这是错误:

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
Run Code Online (Sandbox Code Playgroud)

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

小智 6

我也有这个问题,问题是(正如上面的评论中所建议的那样)我缺少googleConava所需的google guava库.一旦我将它添加到项目中,它按预期编译.