selenium 4 NoSuchMethodError ImmutableMap
时间: 2024-04-29 09:23:22 浏览: 9
The NoSuchMethodError ImmutableMap error in Selenium 4 is caused by a mismatch between the version of the Selenium WebDriver library and other dependencies in your project.
One possible solution is to update your dependencies to use compatible versions of Selenium and related libraries. You can also try removing any conflicting dependencies or upgrading to the latest version of Selenium WebDriver.
In some cases, this error can also be caused by a version conflict between the Selenium WebDriver and Guava libraries. To fix this, you can exclude the Guava dependency from your project and add a compatible version explicitly.
Here is an example Maven dependency configuration that resolves the NoSuchMethodError ImmutableMap issue:
```
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-alpha-7</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
</dependency>
```
Make sure to replace the version numbers with the latest available versions that are compatible with your project.