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

时间:2014-01-14 11:49:58

标签: java selenium netbeans

这是有线问题!我导入的项目是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个月前)

1 个答案:

答案 0 :(得分:6)

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