运行我的测试用例时出现此编译错误。 我最近将selenium jar升级到3.9.0,然后编译停止了。我不知道是否有任何其他依赖我没有实现
WaitUntil.shortWait.until(ExpectedConditions.alertIsPresent());
[javac] ^
[javac] required: Function<? super WebDriver,V>
[javac] found: ExpectedCondition<Alert>
[javac] reason: cannot infer type-variable(s) V
[javac] (argument mismatch; ExpectedCondition<Alert> cannot be converted to Function<? super WebDriver,V>)
[javac] where V,T are type-variables:
[javac] V extends Object declared in method <V>until(Function<? super T,V>)
[javac] T extends Object declared in class FluentWait
public static boolean isAlertPresent(){
boolean foundAlert = false;
// FluentWait<WebDriver> wait = new WebDriverWait(Actions.getDriver(), 2 /*timeout in seconds*/);
try {
WaitUntil.shortWait.until(ExpectedConditions.alertIsPresent());
foundAlert = true;
System.out.println("Alert found");
} catch (TimeoutException eTO) {
foundAlert = false;
System.out.println("Alert not found");
}
return foundAlert;
}
有人可以帮忙吗......
答案 0 :(得分:0)
尝试使用依赖项:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-devtools</artifactId>
<version>4.0.0-alpha-6</version>
</dependency>