java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;I)V with IE and Selenium through Java

This error message…

java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;I)V

…implies that the IEDriverServer was unable to initiate/spawn a new WebBrowsing Session i.e. InternetExplorer Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You have mentioned about using guava-21.0-jre.jar which is pretty ancient.

Solution

Solution to your question would be either/all of the following steps:

  • Upgrade Selenium to current levels Version 3.14.0 which includes guava-25.0-jre.
  • Upgrade Guava to current levels of 26.0-jre (as per Selenium v3.14.0 Java clients).

    • Maven Dependency is as follows:

      <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
      <dependency>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
          <version>26.0-jre</version>
      </dependency>
      
  • Ensure you don’t have several versions in your dependency tree.

    • To look for the existing guava versions through Maven use the command:

      mvn dependency:tree | less
      
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.

  • If issue still persists delete the MAVEN_HOME directory .m2 and download the binaries afresh.

Leave a Comment