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

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)題解決)

備注,我刪除的依賴(lài)是:
<dependency>
? ? ? <groupId>org.seleniumhq.selenium</groupId>
? ? ? <artifactId>selenium-java</artifactId>
? ? ? <version>LATEST</version>
? ? ? <scope>test</scope>
? ? </dependency>