gpt4 book ai didi

java - 调用其他selenium-server maven项目时出现奇怪的问题 "java.lang.NoSuchMethodError"

转载 作者:行者123 更新时间:2023-12-01 18:37:53 29 4
gpt4 key购买 nike

我正在尝试运行一个 Maven 项目(例如 regking),它调用其他 Maven 项目(例如 selenium-geetest-crack),后者在 pom.xml 中包含 selenium-server 库配置

regking的代码是:

public static void main(String[] args) {
try {
new doubanSelenium().requestMobile();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

selenium-geetest-crack 的内容是:

public class doubanSelenium { 

@SuppressWarnings("finally")
public String requestMobile() throws InterruptedException {
ChromeOptions chrome_options = new ChromeOptions();
chrome_options.setBinary("C:\\Users\\Admin\\AppData\\Local\\Yandex\\YandexBrowser\\Application\\browser.exe");
ChromeDriver chrome_driver = new ChromeDriver();
}
}

奇怪的异常代码是:

Exception in thread "main" java.lang.NoSuchMethodError: 'boolean okio.ByteString.startsWith(okio.ByteString)'
at okio.Options.of(Options.java:64)
at okhttp3.internal.Util.<clinit>(Util.java:73)
at okhttp3.internal.connection.RealConnectionPool.<clinit>(RealConnectionPool.java:48)
at okhttp3.ConnectionPool.<init>(ConnectionPool.java:40)
at okhttp3.ConnectionPool.<init>(ConnectionPool.java:36)
at org.openqa.selenium.remote.internal.OkHttpClient$Factory.<init>(OkHttpClient.java:142)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:166)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:404)
at java.base/java.lang.Class.newInstance(Class.java:591)
at org.openqa.selenium.remote.http.HttpClient$Factory.createDefault(HttpClient.java:71)
at org.openqa.selenium.remote.HttpCommandExecutor.<clinit>(HttpCommandExecutor.java:48)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:163)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:105)

selenium-geetest-crack 的 pom.xml 是:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.wycm</groupId>
<artifactId>selenium-geetest-crack</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>selenium-geetest-crack</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>4.0.0-alpha-2</version>
</dependency>

</dependencies>
</project>

最佳答案

可能是您没有正确版本的 selenium 库。这就是我过去发生的事情

关于java - 调用其他selenium-server maven项目时出现奇怪的问题 "java.lang.NoSuchMethodError",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60001636/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com