2014-03-31 21 views
3

我想在Chrome上运行我的WebDriver测试用例在远程Ubuntu服务器上。我已经安装了该服务器上的最新Chrome但我已经得到这些错误,当我用这个:
“HasInputDevices”位于“/ org/openqa/selenium/interactions”,但它仍在查看“/ org/openqa/selenium /”

System.setProperty("webdriver.chrome.driver","/usr/bin/chromedriver"); 
driver = new ChromeDriver(); 

ERROR1:
The driver is not executable: /usr/bin/chromedriver纠正我做它可执行使用sudo 777 chromedriver然后我得到了
误差2:

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally解决这一问题我更新selenium jar dependencies2.40.0,从那时起,我已经得到
误差3:
java.lang.NoClassDefFoundError: org/openqa/selenium/HasInputDevices
查询:现在我知道HasInputDevices已经移动到org/openqa/selenium/Interactions/那么为什么它仍然在寻找旧目录路径org/openqa/selenium/HasInputDevices。如何让它在其实际目录中找到。
1.我更新了依赖关系。
2.我试图使用mvn install,以便下载pom.xml
中的内容,但它正在旧目录中查找。
如何解决此错误,我不想降级硒API,因为然后Chrome意外退出。

+0

好像你必须要对罐子的冲突 - 和你使用的是什么版本的Chrome? – Arran

+0

/usr/bin $ google-chrome --version Google Chrome 33.0.1750.152 – paul

回答

0

我找到了适合我的解决方案。我使用的是依赖这对硒的远程驱动程序版本2.34.0传递依赖,消除这种依赖关系,它会work.This依存度:

<dependency> 
<groupId>com.github.detro.ghostdriver</groupId> 
<artifactId>phantomjsdriver</artifactId> 
<version>1.1.0</version> 
</dependency> 

OR

<dependency> 
<groupId>com.github.detro.ghostdriver</groupId> 
<artifactId>phantomjsdriver</artifactId> 
<version>1.0.4</version> 
</dependency> 
1

有一个类似的问题,获取ClassCastException HasInputDevices与FirefoxDriver不兼容。

通过改变进口到另一个包解决:

进口org.openqa.selenium.Mouse;

进口org.openqa.selenium.interactions.Mouse;

我遇到的确切错误堆栈是:

java.lang.ClassCastException:org.openqa.selenium.firefox.FirefoxDriver不能转换为org.openqa.selenium.interactions.HasInputDevices。

1

我有同样的问题和方法来解决是未来: 从pom.xml的 删除所有未使用的依赖,例如,如果u使用仅FirefoxDriver和POM。XML有anothers一个(铬,普通,远程)删除

相关问题