"Cannot access com.google.common.base.Predicate" 硒化物

"Cannot access com.google.common.base.Predicate" in Selenide

我是 Selenide 的新手,我尝试观看此视频:https://vimeo.com/107647158 8:05 - 第

部分

$("#ires li.g").shouldHave

下划线带有 "Cannot access com.google.common.base.Predicate" 错误。

我尝试了一些 Google 并找到了这个:What is the fix for class file for com.google.common.base.predicate not found? which pointed to https://github.com/google/guava 页面。

我添加了对 pom 的依赖:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.company.myFirstSelenideTest</groupId>
  <artifactId>myFirstSelenideTest</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>metadataTestonDPU</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.codeborne</groupId>
      <artifactId>selenide</artifactId>
      <version>4.12.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>25.1-jre</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
          <fork>true</fork>
          <executable>C:\Program Files\Java\jdk1.8.0_131\bin\javac</executable>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

但这并没有解决我的问题。

我还检查了 %JAVA_HOME% 和 JDK/JRE 的路径,似乎没问题。我错过了什么?

哦,鸭子法...

我在顶部添加了 import com.google.common.base.Predicate; 并且 IntelliJ IDEA 发布在红色 Predicate 部分并提示将其添加到类路径

抱歉这个愚蠢的问题

我在 Predicate 和 Collect 方面遇到了同样的问题,然后在下面添加并且有效

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava-base</artifactId>
    <version>r03</version>
</dependency>
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava-collections</artifactId>
    <version>r03</version>
</dependency>