我想等到js脚本返回true,我使用的代码没有编译并抛出错误
is not abstract and does not override abstract method apply(Object) in Function
这是代码
WebDriverWait wait = new WebDriverWait(driver, 10);
boolean isFound = wait.until(new ExpectedCondition(){ //here ERROR
public Boolean apply(WebDriver d){
JavascriptExecutor js = (JavascriptExecutor) d;
return (Boolean) js.executeScript("return true");
}
});
我试图从中复制代码 http://www.tarnowski.se/2011/09/11/converting-selenium-waitforcondition-to-webdriverwait/
答案 0 :(得分:1)
而不是
public Boolean apply(WebDriver d){
JavascriptExecutor js = (JavascriptExecutor) d;
return (Boolean) js.executeScript("return true");
}
试
public Boolean apply(Object d){
JavascriptExecutor js = (JavascriptExecutor) d;
return (Boolean) js.executeScript("return true");
}
Function类/接口需要在您创建的子类中使用此签名的方法。
如果有raw types
警告,那么您可能会new ExpectedCondition<WebDriver>(){ ...
进行预测吗?