Maven構(gòu)建Test NG項(xiàng)目報(bào)錯(cuò)java.lang.NoClassDefFoundError: org/openqa/selenium/remote/http/HttpClient$Fact...

Maven構(gòu)建Test NG項(xiàng)目報(bào)錯(cuò),解決方案:

java.lang.NoClassDefFoundError

FAILED CONFIGURATION: @BeforeMethod setUp

java.lang.NoClassDefFoundError:org/openqa/selenium/remote/http/W3CHttpCommandCodecatio.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:262)

Caused by:java.lang.ClassNotFoundException:org.openqa.selenium.remote.http.W3CHttpCommandCodec at java.net.URLClassLoader.findClass(UnknownSource)

網(wǎng)上查詢(xún)解決方案:

1、在pom.xml里添加selenium-remote-driver依賴(lài)

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-remote-driver</artifactId>

<version>3.4.0</version>

</dependency>

2、降低testng版本號(hào): <dependency>

? ? <groupId>org.testng</groupId>

? ? <artifactId>testng</artifactId>

? ? ? ? <version>7.0.0</version>

? ? </dependency>

3、依賴(lài)包沖突,刪除多余的依賴(lài)(該方法問(wèn)題解決)

在maven的pom文件中移除不需要的依賴(lài)

備注,我刪除的依賴(lài)是:

<dependency>

? ? ? <groupId>org.seleniumhq.selenium</groupId>

? ? ? <artifactId>selenium-java</artifactId>

? ? ? <version>LATEST</version>

? ? ? <scope>test</scope>

? ? </dependency>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容