初始化chome驱动程序时出现以下错误。任何人都可以建议如何解决此问题。
我正在使用以下版本。
System.setProperty("webdriver.chrome.driver","C:\\chromedriver_win32\\chromedriver.exe");
2020-11-04 13:12:53.293 ERROR 1656 --- [nio-8080-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkState(boolean, java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object)'] with root cause
java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkState(boolean, java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object)'
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:134) ~[selenium-remote-driver-3.141.59.jar:na]
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35) ~[selenium-chrome-driver-3.141.59.jar:na]
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:159) ~[selenium-chrome-driver-3.141.59.jar:na]
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355) ~[selenium-remote-driver-3.141.59.jar:na]
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94) ~[selenium-chrome-driver-3.141.59.jar:na]
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123) ~[selenium-chrome-driver-3.141.59.jar:na]
at au.com.optus.uam.AccountController.unlockUser(AccountController.java:47) ~[classes/:na]
我的POM.xml在下面
答案 0 :(得分:1)
请在您的pom文件上添加依赖项,然后尝试运行
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
</dependency>