Exception in thread quot;mainquot; java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)(线程“main中的异常java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/Stri
问题描述
我开发的 selenium 代码:
I develop the selenium code that:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import java.util.List;
public class TestDemoQA {
public static void main(String[] args) throws InterruptedException{
System.setProperty("webdriver.edge.driver", "C:\Users\Suganthan\Downloads\MicrosoftWebDriver.exe");
WebDriver driver = new EdgeDriver();
driver.get("http://demoqa.com/");
driver.manage().window().maximize();`
我收到的错误是:
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;)
我正在尝试根据 此解决方案通过升级 guava 来解决此问题-21.0.但我仍然收到此错误.谁能给出解决方案?
I'm trying to solve this issue according to This Solution by upgrading guava-21.0. But I'm still getting this error. could anyone give a solution to solve it?
推荐答案
这个错误信息...
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;)
...暗示 JVM 无法启动/生成您的程序.
...implies that the JVM was unable to initiate/spawn your program.
正如@GhostCat 指出的那样,您的主要问题是 guava 版本与您正在使用的其他二进制版本之间的不兼容.
As @GhostCat pointed your main issue is the incompatibility between the guava version and other binary versions you are using.
- 将 JDK 升级到最新级别 <强>JDK 8u181.
- 将 Selenium 升级到当前级别版本 3.14.0.
- 当您删除以前版本的 Selenium Client 时,请确保正确删除所有关联的 jars.
- 清理你的项目工作区通过你的IDE和重建你的项目只需要依赖.
- 执行你的
@Test
.
- 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
.
这篇关于线程“main"中的异常java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:线程“main"中的异常java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)
基础教程推荐
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 降序排序:Java Map 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01