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

问题描述 投票:1回答:2

如何解决以下错误消息

java.lang.AbstractMethodError:org.openqa.selenium.MutableCapabilities.is(Ljava / lang / String;)Z在自动化项目中使用Java,Selenium Server(具有配置: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>

只有我使用的这些代码行:

System.setProperty("webdriver.gecko.driver", "C:\\Users\\Aila\\Downloads\\geckodriver-v0.19.1-win32\\geck‌​odriver.exe"); 
driver = new FirefoxDriver(); 
maven selenium selenium-firefoxdriver selenium-server
2个回答
0
投票

错误说明了一切:

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

首先确保您使用的是所有最新版本的二进制文件和罐子(SeleniumGeckoDriverFirefox Browser)。

如果你想使用Maven

  • 删除所有与Selenium手动添加的Project相关的罐子
  • 仅通过Selenium使用TestNGMaven Dependencies相关的罐子。
  • Clean Project
  • 执行maven clean install test

如果你想在没有Selenium的情况下使用TestNGMaven

  • 删除所有Selenium相关的罐子,并在你的selenium-server-standalone-3.7.1中只添加Project
  • Clean Project
  • 执行你的Test作为TestNG TestTestNG Suite

0
投票

打开Windows命令提示符并键入以下命令:

java -Dwebdriver.gecko.driver="C:\NewAutomationCICD\resource\chromedriver.exe" -jar C:\NewAutomationCICD\libs\selenium-server-standalone-2.42.2.jar
© www.soinside.com 2019 - 2024. All rights reserved.