Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)

前端 未结 3 590
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 04:59

I develop the selenium code that:

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
           


        
相关标签:
3条回答
  • 2020-12-07 05:33

    Finally, I found a solution for this. It's simple guys. Add latest guava jar in your project. Note: If you have already old one jar (Please remove that and add it new one). Follow the link : mvnrepository.com/artifact/com.google.guava/guava/29.0-jre

    0 讨论(0)
  • 2020-12-07 05:37

    Note that you remove the old guava you have from the jar lists and only then replace with the new one

    0 讨论(0)
  • 2020-12-07 05:46

    This error message...

    Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)
    

    ...implies that the JVM was unable to initiate/spawn your program.

    As @GhostCat pointed your main issue is the incompatibility between the guava version and other binary versions you are using.

    Solution

    • Upgrade JDK to recent levels JDK 8u181.
    • Upgrade Selenium to current levels Version 3.14.0.
    • When you remove the previous version of Selenium Client ensure that all the associated jars are properly removed.
    • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
    • Execute your @Test.
    0 讨论(0)
提交回复
热议问题