0
我正在使用java,maven,selenium-webdriver.I已添加依赖关系'selenium-server 2.32.0','selenium-java 2.32.0'。但我越来越例外情况如下: 以下是代码: -在maven中运行selenium测试时得到异常
public class ABC{
private static WebDriver webDriver ;
public static void main(String [] args) throws IOException{
ChromeDriverService service = new ChromeDriverService.Builder()
.usingDriverExecutable(
new File("/root/Downloads/chromedriver"))
.usingAnyFreePort().build();
service.start();
webDriver = new RemoteWebDriver(service.getUrl(),
DesiredCapabilities.chrome());
//webDriver = new FirefoxDriver();
}
}
正如你看到的,我也firefoxdriver实例,但得到相同的异常产生。
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.conn.scheme.Scheme.<init>(Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V
at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:59)
at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:48)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:100)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:81)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129).
还增加了“的HttpClient 4.1.2”。但得到相同的异常,请指导我如何解决这个
你能提供完整的堆栈跟踪和代码? – aimbire 2013-05-10 13:07:48
在这里有一个模板,你可以尝试:https://github.com/Ardesco/Selenium-Maven-Template – Ardesco 2013-05-10 13:21:49