selenium4 NoSuchMethodError ImmutableMap
时间: 2024-05-10 12:20:24 浏览: 116
NoSuchMethodError
This error occurs when there is a mismatch between the version of Selenium being used and the version of the Google Guava library being used. In Selenium 4, the dependency on Google Guava has been updated to version 30.0-jre, but if an older version of Guava is still being used, it can cause this error.
To fix this issue, you should update the version of Google Guava being used in your project to the latest version. You can do this by updating the dependency in your build file (e.g. pom.xml for Maven, build.gradle for Gradle) to:
```
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
</dependency>
```
or
```
implementation 'com.google.guava:guava:30.0-jre'
```
Once you have updated the Guava dependency, try running your tests again. This should resolve the NoSuchMethodError ImmutableMap issue.
阅读全文