如何为 Selenium 独立服务器更新番石榴
How to update guava for Selenium Standalone Server
我在 Selenium 中有一个工作代码。
更新 Geckodriver 和 Selenium 独立服务器后,Webdriver wait.until()
功能不再起作用。
所以在使用 google 之后,我注意到我还必须将番石榴更新到版本 23。
在eclipse中,我将这个guava版本导入到项目中,但功能仍然不可用。
有没有人遇到过这个问题或知道解决方案?
此致
编辑:
这是错误信息:
The method until(Function) in the type
FluentWait is not applicable for the arguments
(Predicate)
但我实际上并没有使用 FluentWait。我使用 WebDriverWait
void waitForPageLoad(double d){
WebDriverWait wait = new WebDriverWait(this.driver, 10);
Predicate<WebDriver> pageLoaded = new Predicate<WebDriver>(){
@Override
public boolean apply(WebDriver input){
return ((JavascriptExecutor) input).executeScript("return document.readyState").equals("complete");
}
};
try {
Thread.sleep((long) (d*1000));
} catch (InterruptedException e) {
e.printStackTrace();
}
wait.until(pageLoaded);
}
void waitForPageLoad(double d){
try {
Thread.sleep((long) (d*1000));
} catch (InterruptedException e) {
e.printStackTrace();
}
new WebDriverWait(this.driver, (long) (10000)).until(driver ->
((JavascriptExecutor) driver).executeScript("return document.readyState").equals("complete"));
}
我找到了这个解决方案并且它正在运行。因此不再需要手动更新 Guava。他们只是在他们的框架中改变了一些东西
我在 Selenium 中有一个工作代码。
更新 Geckodriver 和 Selenium 独立服务器后,Webdriver wait.until()
功能不再起作用。
所以在使用 google 之后,我注意到我还必须将番石榴更新到版本 23。
在eclipse中,我将这个guava版本导入到项目中,但功能仍然不可用。
有没有人遇到过这个问题或知道解决方案?
此致
编辑:
这是错误信息:
The method until(Function) in the type FluentWait is not applicable for the arguments (Predicate)
但我实际上并没有使用 FluentWait。我使用 WebDriverWait
void waitForPageLoad(double d){
WebDriverWait wait = new WebDriverWait(this.driver, 10);
Predicate<WebDriver> pageLoaded = new Predicate<WebDriver>(){
@Override
public boolean apply(WebDriver input){
return ((JavascriptExecutor) input).executeScript("return document.readyState").equals("complete");
}
};
try {
Thread.sleep((long) (d*1000));
} catch (InterruptedException e) {
e.printStackTrace();
}
wait.until(pageLoaded);
}
void waitForPageLoad(double d){
try {
Thread.sleep((long) (d*1000));
} catch (InterruptedException e) {
e.printStackTrace();
}
new WebDriverWait(this.driver, (long) (10000)).until(driver ->
((JavascriptExecutor) driver).executeScript("return document.readyState").equals("complete"));
}
我找到了这个解决方案并且它正在运行。因此不再需要手动更新 Guava。他们只是在他们的框架中改变了一些东西