java - Chrome 选项 - Selenium 3.10 - NoSuchMethodError : com. google.common.collect.ImmutableList.toImmutableList()

标签 java selenium selenium-webdriver webdriver guava

Selenium - 3.10.0 Guava 用作 -

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>RELEASE</version>
</dependency>

排除所有其他 Guava 依赖项。

如何解决这个异常?

java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector; 
    at org.openqa.selenium.chrome.ChromeOptions.asMap(ChromeOptions.java:306) 
    at org.openqa.selenium.MutableCapabilities.merge(MutableCapabilities.java:74) 
    at org.openqa.selenium.remote.DesiredCapabilities.merge(DesiredCapabilities.java:107)     
    at org.openqa.selenium.remote.DesiredCapabilities.merge(DesiredCapabilities.java:33) 
    at org.openqa.selenium.MutableCapabilities.setCapability(MutableCapabilities.java:97)

net.sourceforge.jtds:jtds:jar:1.3.1:compile
org.apache.httpcomponents:httpclient:jar:4.4.1:compile
com.hynnet:oracle-driver-ojdbc6:jar:12.1.0.1:compile
com.thoughtworks.paranamer:paranamer:jar:2.8:compile
xml-apis:xml-apis:jar:1.4.01:compile
org.slf4j:slf4j-log4j12:jar:1.7.5:compile
org.hdrhistogram:HdrHistogram:jar:1.2.1:compile
junit:junit:jar:4.12:compile org.hamcrest:hamcrest-core:jar:1.3:compile
org.mockito:mockito-core:jar:1.10.19:compile org.objenesis:objenesis:jar:2.1:compile
org.powermock:powermock-api-mockito:jar:1.6.2:compile
org.mockito:mockito-all:jar:1.10.19:compile org.powermock:powermock-api-support:jar:1.6.2:compile org.powermock:powermock-core:jar:1.6.2:compile org.powermock:powermock-reflect:jar:1.6.2:compile
org.powermock:powermock-module-junit4:jar:1.6.2:compile org.powermock:powermock-module-junit4-common:jar:1.6.2:compile
org.hamcrest:hamcrest-all:jar:1.3:compile
info.cukes:cucumber-java:jar:1.2.5:compile info.cukes:cucumber-core:jar:1.2.5:compile info.cukes:cucumber-html:jar:0.2.3:compile info.cukes:cucumber-jvm-deps:jar:1.0.5:compile info.cukes:gherkin:jar:2.12.2:compile
info.cukes:cucumber-junit:jar:1.2.5:compile
org.aspectj:aspectjrt:jar:1.8.3:compile
com.google.code.gson:gson:jar:2.8.0:compile
com.esotericsoftware.yamlbeans:yamlbeans:jar:1.11:compile
com.fasterxml.jackson.core:jackson-core:jar:2.5.4:compile
org.apache.logging.log4j:log4j-api:jar:2.8.2:compile
org.apache.logging.log4j:log4j-core:jar:2.8.2:compile
log4j:log4j:jar:1.2.17:compile
org.apache.commons:commons-lang3:jar:3.4:compile
commons-io:commons-io:jar:2.4:compile
org.quickfixj:quickfixj-core:jar:1.6.4:compile org.apache.mina:mina-core:jar:2.0.16:compile
javax.jms:jms:jar:1.2:compile net.sf.expectit:expectit-core:jar:0.8.2:compile
com.jcraft:jsch:jar:0.1.54:compile commons-lang:commons-lang:jar:2.6:compile org.apache.httpcomponents:fluent-hc:jar:4.5.3:compile org.apache.wink:wink-json4j:jar:1.4:compile org.apache.activemq:activemq-client:jar:5.14.5:compile com.hp.lft:sdk:jar:14.0.0:compile
com.hp.lft:sdk:jar:javadoc:14.0.0:compile
com.hp.lft:report:jar:14.0.0:compile
com.hp.lft:unittesting:jar:14.0.0:compile
com.hp.lft:verifications:jar:14.0.0:compile
com.hp.lft:reportbuilder:jar:14.0.0:compile
com.hp.lft:common:jar:14.0.0:compile
javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
com.sun.jersey:jersey-client:jar:1.13:compile com.sun.jersey:jersey-core:jar:1.13:compile
org.glassfish.jersey.core:jersey-client:jar:2.8:compile
org.glassfish.jersey.core:jersey-common:jar:2.8:compile org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.8:compile org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
org.glassfish.hk2:hk2-api:jar:2.2.0:compile org.glassfish.hk2:hk2-utils:jar:2.2.0:compile org.glassfish.hk2.external:aopalliance-repackaged:jar:2.2.0:compile
org.glassfish.hk2.external:javax.inject:jar:2.2.0:compile org.glassfish.hk2:hk2-locator:jar:2.2.0:compile org.javassist:javassist:jar:3.18.1-GA:compile org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.8:compile org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile org.codehaus.jackson:jackson-jaxrs:jar:1.9.13:compile org.codehaus.jackson:jackson-xc:jar:1.9.13:compile com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.7.3:compile org.yaml:snakeyaml:jar:1.15:compile com.fasterxml.jackson.core:jackson-databind:jar:2.5.4:compile com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile org.apache.logging.log4j:log4j-slf4j-impl:jar:2.1:compile org.slf4j:slf4j-api:jar:1.7.7:compile com.vimalselvam:cucumber-extentsreport:jar:2.0.1:compile com.aventstack:extentreports:jar:3.0.6:compile
org.freemarker:freemarker:jar:2.3.23:compile
org.mongodb:mongodb-driver:jar:3.3.0:compile
org.mongodb:bson:jar:3.3.0:compile org.mongodb:mongodb-driver-core:jar:3.3.0:compile
org.apache.httpcomponents:httpmime:jar:4.5.2:compile org.jsoup:jsoup:jar:1.9.2:compile com.relevantcodes:extentreports:jar:2.41.0:compile org.apache.poi:poi:jar:3.16:compile
commons-codec:commons-codec:jar:1.10:compile org.apache.commons:commons-collections4:jar:4.1:compile org.apache.poi:poi-ooxml:jar:3.16:compile
org.apache.poi:poi-ooxml-schemas:jar:3.16:compile com.github.virtuald:curvesapi:jar:1.04:compile org.apache.poi:ooxml-schemas:jar:1.3:compile org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile stax:stax-api:jar:1.0.1:compile org.ini4j:ini4j:jar:0.5.1:compile com.monitorjbl:xlsx-streamer:jar:1.2.0:compile xerces:xercesImpl:jar:2.11.0:compile org.seleniumhq.selenium:selenium-java:jar:3.10.0:compile
org.seleniumhq.selenium:selenium-api:jar:3.10.0:compile
org.seleniumhq.selenium:selenium-chrome-driver:jar:3.10.0:compile
org.seleniumhq.selenium:selenium-edge-driver:jar:3.10.0:compile
org.seleniumhq.selenium:selenium-firefox-driver:jar:3.10.0:compile
org.seleniumhq.selenium:selenium-ie-driver:jar:3.10.0:compile
org.seleniumhq.selenium:selenium-opera-driver:jar:3.10.0:compile
org.seleniumhq.selenium:selenium-safari-driver:jar:3.10.0:compile
org.seleniumhq.selenium:selenium-support:jar:3.10.0:compile
net.bytebuddy:byte-buddy:jar:1.7.9:compile
org.apache.commons:commons-exec:jar:1.3:compile
commons-logging:commons-logging:jar:1.2:compile
org.apache.httpcomponents:httpcore:jar:4.4.6:compile
com.squareup.okhttp3:okhttp:jar:3.9.1:compile com.squareup.okio:okio:jar:1.13.0:compile org.seleniumhq.selenium:selenium-server:jar:3.10.0:compile
com.beust:jcommander:jar:1.72:compile
org.apache.commons:commons-text:jar:1.1:compile
commons-net:commons-net:jar:3.6:compile
org.w3c.css:sac:jar:1.3:compile
net.sourceforge.cssparser:cssparser:jar:0.9.24:compile
net.sourceforge.htmlunit:htmlunit:jar:2.29:compile
net.sourceforge.htmlunit:htmlunit-core-js:jar:2.28:compile
net.sourceforge.htmlunit:neko-htmlunit:jar:2.28:compile
net.jcip:jcip-annotations:jar:1.0:compile
org.seleniumhq.selenium:jetty-repacked:jar:9.4.7.v20171121:compile
org.eclipse.jetty:jetty-client:jar:9.4.7.v20170914:compile
org.eclipse.jetty:jetty-http:jar:9.4.8.v20171121:compile
org.eclipse.jetty:jetty-io:jar:9.4.8.v20171121:compile
org.eclipse.jetty:jetty-util:jar:9.4.8.v20171121:compile
org.eclipse.jetty:jetty-xml:jar:9.4.7.v20170914:compile
org.seleniumhq.selenium:htmlunit-driver:jar:2.29.0:compile
javax.servlet:javax.servlet-api:jar:3.1.0:compile
org.eclipse.jetty.websocket:websocket-api:jar:9.4.7.v20170914:compile org.eclipse.jetty.websocket:websocket-client:jar:9.4.7.v20170914:compile org.eclipse.jetty.websocket:websocket-common:jar:9.4.7.v20170914:compile xalan:serializer:jar:2.7.2:compile xalan:xalan:jar:2.7.2:compile org.seleniumhq.selenium:selenium-remote-driver:jar:3.10.0:compile com.google.guava:guava:jar:23.6-jre:compile com.google.code.findbugs:jsr305:jar:1.3.9:compile org.checkerframework:checker-compat-qual:jar:2.0.0:compile com.google.errorprone:error_prone_annotations:jar:2.1.3:compile com.google.j2objc:j2objc-annotations:jar:1.1:compile org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile

最佳答案

将此显式依赖项添加到我的 pom.xml 中解决了我的问题。

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>25.0-jre</version>
</dependency>

关于java - Chrome 选项 - Selenium 3.10 - NoSuchMethodError : com. google.common.collect.ImmutableList.toImmutableList(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50267144/

相关文章:

java - 如何在 jcombobox 中显示泰米尔语和英语字符 - java

java - 如何在没有包的情况下获取类的名称?

Java - 登录到使用基于表单的身份验证的网站

c# - Selenium 错误 - 对远程 WebDriver 的 HTTP 请求在 60 秒后超时

javascript - 未从 Selenium Webdriver 中的配置文件接收到正确的值

java - 通过java运行curl命令时出错

python-3.x - 加载资源失败 : the server responded with a status of 429 (Too Many Requests) and 404 (Not Found) with ChromeDriver Chrome through Selenium

css - 如何找到错误消息标签 Selenium WebDriver 的 xpath 或 css 定位器

selenium - 面临 Safari 5 和 Selenium-WebDriver 的问题

java - 页面对象模型 Selenium,将等待添加到测试类中