Maven构建Test NG项目报错java.lang.NoClassDefFoundError: org/openqa/selenium/remote/http/HttpClient$Fact...

Maven构建Test NG项目报错,解决方案:

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)

网上查询解决方案:

1、在pom.xml里添加selenium-remote-driver依赖

org.seleniumhq.selenium

selenium-remote-driver

3.4.0

2、降低testng版本号:

    org.testng

    testng

        7.0.0

   

3、依赖包冲突,删除多余的依赖(该方法问题解决)

在maven的pom文件中移除不需要的依赖

备注,我删除的依赖是:

      org.seleniumhq.selenium

      selenium-java

      LATEST

      test

   

你可能感兴趣的:(Maven构建Test NG项目报错java.lang.NoClassDefFoundError: org/openqa/selenium/remote/http/HttpClient$Fact...)