如何解决以下错误消息
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\\geckodriver.exe");
driver = new FirefoxDriver();
错误说明了一切:
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
首先确保您使用的是所有最新版本的二进制文件和罐子(Selenium
,GeckoDriver
,Firefox Browser
)。
如果你想使用Maven
:
Selenium
手动添加的Project
相关的罐子Selenium
使用TestNG
和Maven Dependencies
相关的罐子。Clean
Project
maven clean install test
如果你想在没有Selenium
的情况下使用TestNG
和Maven
:
Selenium
相关的罐子,并在你的selenium-server-standalone-3.7.1
中只添加Project
Clean
Project
Test
作为TestNG Test
或TestNG Suite
打开Windows命令提示符并键入以下命令:
java -Dwebdriver.gecko.driver="C:\NewAutomationCICD\resource\chromedriver.exe" -jar C:\NewAutomationCICD\libs\selenium-server-standalone-2.42.2.jar