java.lang.NoSuchMethodError:com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector

java.lang.NoSuchMethodError:com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector,java,selenium,selenium-webdriver,electron,testng,Java,Selenium,Selenium Webdriver,Electron,Testng,我对这个错误有一个非常严重的问题,没有任何东西能解决它。我已经使用了其他人的所有解决方案,但它不起作用。guava版本25.0-jre已经显示在libraries下 首先,它是一个电子应用程序,并开始使用ChromeOptions。虽然我没有做任何更改,但今天早上有效的代码在晚上无效。我真的需要帮助 JDK版本:1.8.0_221 Chrome版本:79.03945.36 public void setupEnvironment() throws InterruptedException, Fi

我对这个错误有一个非常严重的问题,没有任何东西能解决它。我已经使用了其他人的所有解决方案,但它不起作用。guava版本25.0-jre已经显示在libraries下

首先,它是一个电子应用程序,并开始使用ChromeOptions。虽然我没有做任何更改,但今天早上有效的代码在晚上无效。我真的需要帮助

JDK版本:1.8.0_221 Chrome版本:79.03945.36

public void setupEnvironment() throws InterruptedException, FindFailed {
    ChromeOptions opt = new ChromeOptions();
    System.setProperty("webdriver.chrome.driver", "C:\\Users\\ayaz\\Documents\\chromedriver_win32\\chromedriver.exe");
    opt.setBinary("C:\\Program Files\\app\\app.exe");
    driver = new ChromeDriver(opt);
}




<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
        <scope>test</scope>
    </dependency>
    
</dependencies>



java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector;

at org.openqa.selenium.chrome.ChromeOptions.asMap(ChromeOptions.java:292)
at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:94)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
at Utils.TestStructure.setupEnvironment(TestStructure.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:168)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:110)
public void setupEnvironment()抛出InterruptedException,FindFailed{
ChromeOptions opt=新的ChromeOptions();
System.setProperty(“webdriver.chrome.driver”,“C:\\Users\\ayaz\\Documents\\chromedriver\u win32\\chromedriver.exe”);
opt.setBinary(“C:\\Program Files\\app\\app.exe”);
驱动器=新的色度驱动器(opt);
}
org.seleniumhq.selenium
硒爪哇
3.141.59
org.testng
testng
6.14.3
测试
java.lang.NoSuchMethodError:com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector;
位于org.openqa.selenium.chrome.ChromeOptions.asMap(ChromeOptions.java:292)
位于org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:94)
位于org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
位于org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
位于org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
位于org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
位于org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
位于org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:131)
位于org.openqa.selenium.chrome.ChromeDriver(ChromeDriver.java:181)
位于org.openqa.selenium.chrome.ChromeDriver(ChromeDriver.java:168)
位于org.openqa.selenium.chrome.ChromeDriver(ChromeDriver.java:157)
位于Utils.TestStructure.setupEnvironment(TestStructure.java:23)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
位于java.lang.reflect.Method.invoke(Method.java:498)
位于org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
位于org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
位于org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
位于org.testng.internal.Invoker.invokeConfigulations(Invoker.java:222)
位于org.testng.internal.Invoker.invokeConfigulations(Invoker.java:142)
位于org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:168)
位于org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
位于org.testng.TestRunner.privateRun(TestRunner.java:648)
位于org.testng.TestRunner.run(TestRunner.java:505)
位于org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
在org.testng.SuiteRunner.runsequential上(SuiteRunner.java:450)
位于org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
运行(SuiteRunner.java:364)
位于org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
位于org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
在org.testng.testng.runSuitesSequentially上(testng.java:1208)
位于org.testng.testng.runSuitesLocally(testng.java:1137)
位于org.testng.testng.runSuites(testng.java:1049)
位于org.testng.testng.run(testng.java:1017)
在com.intellij.rt.testng.idearemotestng.run上(idearemotestng.java:66)
在com.intellij.rt.testng.RemoteTestNGStarter.main上(RemoteTestNGStarter.java:110)
已解决


我使用了一个外部jar并将其添加到maven local repo中。与我使用的-clear和-install命令相比,问题得到了解决

我认为您可能需要尝试
opt.setBinary(新文件(“/path/to/chrome”)?我已经试过了,但它不起作用。我真的很沮丧,现在不知道是什么影响了我的项目。我没有改变任何事情,它不起作用。。。