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