Maven 如何修复:TestNG java.lang.AbstractMethodError中的错误消息:org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z

Maven 如何修复:TestNG java.lang.AbstractMethodError中的错误消息:org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z,maven,selenium,selenium-firefoxdriver,selenium-server,Maven,Selenium,Selenium Firefoxdriver,Selenium Server,如何解决以下错误消息 java.lang.AbstractMethodError: org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z in 带有Java、Selenium服务器的自动化项目(具有 配置:client-combined-3.7.1-sources,client-combined-3.7.1, commo ns-lang-2.6,org.eclipse.jgit_4.5.0.201609210915-r,

如何解决以下错误消息

java.lang.AbstractMethodError: org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z in 带有Java、Selenium服务器的自动化项目(具有 配置:client-combined-3.7.1-sources,client-combined-3.7.1, commo ns-lang-2.6,org.eclipse.jgit_4.5.0.201609210915-r, selenium-firefox-driver-3.0.0-beta1,selenium-server-standalone-3.7.1 firefox v.44)

我尝试了许多selenium服务器和selenium Firefox驱动程序的组合,但我收到了其他错误

<dependencies> 
  <dependency> 
    <groupId>org.testng</groupId> 
    <artifactId>testng</artifactId> 
    <version>6.8.8</version> 
    <scope>test</scope> 
  </dependency> 
  <dependency> 
    <groupId>org.seleniumhq.selenium</groupId> 
    <artifactId>selenium-java</artifactId> 
    <version>3.7.1</version> 
  </dependency> 
</dependencies>
错误说明了一切:

java.lang.AbstractMethodError: org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z in automation project with Java, Selenium Server (having the configuration : client-combined-3.7.1-sources, client-combined-3.7.1, commo ns-lang-2.6, org.eclipse.jgit_4.5.0.201609210915-r, selenium-firefox-driver-3.0.0-beta1, selenium-server-standalone-3.7.1
首先,确保您使用的是最新版本的所有二进制文件和JAR(
Selenium
GeckoDriver
Firefox浏览器

如果您想使用Maven:

  • 项目中删除手动添加的所有
    Selenium
    相关罐子
  • 只能通过
    Maven依赖项使用
    Selenium
    TestNG
    相关jar
  • 清洁
    项目
  • 执行maven清洁安装测试
如果要在不使用Maven的情况下使用Selenium和TestNG,请执行以下操作:

  • 一次性移除所有
    Selenium
    相关JAR,并仅在
    项目中添加
    Selenium-server-standalone-3.7.1
  • 清洁
    项目
  • 执行
    测试
    作为
    TestNG测试
    TestNG套件
    • 错误说明了一切:

      java.lang.AbstractMethodError: org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z in automation project with Java, Selenium Server (having the configuration : client-combined-3.7.1-sources, client-combined-3.7.1, commo ns-lang-2.6, org.eclipse.jgit_4.5.0.201609210915-r, selenium-firefox-driver-3.0.0-beta1, selenium-server-standalone-3.7.1
      
      首先,确保您使用的是最新版本的所有二进制文件和JAR(
      Selenium
      GeckoDriver
      Firefox浏览器

      如果您想使用Maven

      • 项目中删除手动添加的所有
        Selenium
        相关罐子
      • 只能通过
        Maven依赖项使用
        Selenium
        TestNG
        相关jar
      • 清洁
        项目
      • 执行maven清洁安装测试
      如果要在不使用Maven的情况下使用Selenium和TestNG,请执行以下操作:

      • 一次性移除所有
        Selenium
        相关JAR,并仅在
        项目中添加
        Selenium-server-standalone-3.7.1
      • 清洁
        项目
      • 执行
        测试
        作为
        TestNG测试
        TestNG套件

      有两种解决方案:

    • 在Selenium项目中添加正确的版本,因为不同的版本对我的问题没有相同的解决方案Selenium-server-standalone-2.42.2.jar是正确的
    • 此选项是可选的,如果此问题的任何解决方案都无法解决,请尝试
    • 打开Windows命令提示符并键入以下命令:

      java-Dwebdriver.gecko.driver=“C:\NewAutomationCICD\resource\chromedriver.exe”-jar C:\NewAutomationCICD\libs\selenium-server-standalone-2.42.2.jar

      此问题有两种解决方案:

    • 在Selenium项目中添加正确的版本,因为不同的版本对我的问题没有相同的解决方案Selenium-server-standalone-2.42.2.jar是正确的
    • 此选项是可选的,如果此问题的任何解决方案都无法解决,请尝试
    • 打开Windows命令提示符并键入以下命令:

      java-Dwebdriver.gecko.driver=“C:\NewAutomationCICD\resource\chromedriver.exe”-jar C:\NewAutomationCICD\libs\selenium-server-standalone-2.42.2.jar

      您能在问题中显示项目maven配置的XML吗?尤其是
      依赖项
      部分。org.testng testng 6.8.8 test org.seleniumhq.selenium selenium java 3.7.1无论如何,我不是从pom文件运行测试,我只是使用Run-as TestNGYou从2016年9月开始使用
      selenium-firefox-driver-3.0.0-beta
      ,虽然nevest版本是:谢谢你的回复,我添加了它,但我有相同的错误。你能在问题中显示项目maven配置的XML吗?尤其是
      依赖项
      部分。org.testng testng 6.8.8 test org.seleniumhq.selenium selenium java 3.7.1无论如何,我不是从pom文件运行测试,我只是使用Run-as TestNGYou从2016年9月开始使用
      selenium-firefox-driver-3.0.0-beta
      ,最新的版本是:谢谢你的回复,我添加了它,但我有同样的错误。谢谢你的回答,但似乎我做的每件事都面临着同样的错误。我有以下JAR:selenium 3.7.1、webdriver 1.6.2、testng 11.6。我做了清洁项目,mvn清洁安装测试;仍然显示了相同的错误现在我面临另一个错误,在classpath中找不到类:Tests.CreateDeviceTest在org.testng.xml.XmlClass.loadClass(XmlClass.java:81)在org.testng.xml.XmlClass.init(XmlClass.java:73)在org.testng.xml.XmlClass。