'错误:java:无法访问java.util.function.Function'-尝试使用WebDriverWait时

时间:2019-08-02 11:21:48

标签: java maven selenium

我正在使用Maven和Intellij,项目设置为jdk-12.0.2,在pom 1.8中为maven,并且尝试运行此代码时:

WebDriverWait wait = new WebDriverWait(driver, 5);
WebElement el =  wait.until(ExpectedConditions.elementToBeClickable(By.linkText("https://poczta.wp.pl")));

我明白了:

  

错误:(37,30)java:无法访问java.util.function.Function类   找不到java.util.function.Function的文件

指向“等待”

尝试将pom中的行家从1.7更改为1.8。 > Invalidate cache/Restart

1 个答案:

答案 0 :(得分:1)

鉴于您有Firebase Cloud Functions,我的期望是您的项目由Maven管理,因此由maven tag构建,因此您的IDE语言级别设置可能源自Maven Compiler Plugin中定义的内容< / p>

我建议在以下位置设置项目语言级别:

  1. pom.xml喜欢:

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>    
    
  2. Maven pom.xml file,您可以为每个模块选择语言级别

    In Idea on Project Properties page

更多信息: