我在通过selenium启动chrome浏览器时遇到错误堆栈。 Chrome版本为65。
[AppClassLoader@18b4aac2] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 40188
Only local connections are allowed.
org.testng.TestNGException:
Cannot instantiate class ipd.project.analytics.BarChart
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:31)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:410)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:323)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:126)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:191)
at org.testng.TestClass.getInstances(TestClass.java:99)
at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:85)
at org.testng.TestClass.init(TestClass.java:77)
at org.testng.TestClass.<init>(TestClass.java:42)
at org.testng.TestRunner.initMethods(TestRunner.java:423)
at org.testng.TestRunner.init(TestRunner.java:250)
at org.testng.TestRunner.init(TestRunner.java:220)
at org.testng.TestRunner.<init>(TestRunner.java:169)
newInstance(Constructor.java:423)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:23)
... 25 more
Caused by: java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.toImmutableSet()Ljava/util/stream/Collector;
at org.openqa.selenium.remote.ProtocolHandshake.streamW3CProtocolParameters(ProtocolHandshake.java:284)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:149)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:184)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:148)
at ipd.Base.setupChromeDriver(Base.java:143)
at ipd.Base.<init>(Base.java:61)
at ipd.project.analytics.BarChart.<init>(BarChart.java:28)
... 30 more
Suppressed: java.io.IOException: Incomplete document
at com.google.gson.stream.JsonWriter.close(JsonWriter.java:559)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:167)
... 41 more
我尝试在pom.xml中添加以下依赖项,但它没有帮助:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
清洁,构建项目也没有帮助。
谢谢!