我在编译时会出现错误:
public static WebDriverWait wait = null;
wait = new WebDriverWait(driver, 120);
wait.until(ExpectedConditions.presenceOfElementLocated(By.id(HomeScreen.tabHome_ID)));
我正在使用Intellij IDE
错误
Error:(51, 19) java: method until in class org.openqa.selenium.support.ui.FluentWait cannot be applied to given types;
required: java.util.function.Function<? super org.openqa.selenium.WebDriver,V>
found: org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>
reason: cannot infer type-variable(s) V
(argument mismatch; org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement> cannot be converted to java.util.function.Function<? super org.openqa.selenium.WebDriver,V>)
这可能是JRE版本的问题。如果您使用的是Maven将其添加到POM文件中以指定Java版本(您可以将1.8
更改为所使用的任何版本(
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
您也可以在文件>设置>构建,执行,部署>编译器> Java编译器中更改它,在 target bytecode版本column。
<</p>