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

前端 未结 3 676
伪装坚强ぢ
伪装坚强ぢ 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: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.

提交回复
热议问题