[英]“HasInputDevices” is located at “/org/openqa/selenium/interactions” but it is still looking at “/org/openqa/selenium/”
I want to run my WebDriver
test cases on Chrome
on remote Ubuntu
server. 我想在远程Ubuntu
服务器上的Chrome
上运行我的WebDriver
测试用例。 I have installed latest Chrome
on that server but I've been getting these errors,when I used this: 我在该服务器上安装了最新的Chrome
,但是当我使用它时,我一直在收到这些错误:
System.setProperty("webdriver.chrome.driver","/usr/bin/chromedriver");
driver = new ChromeDriver();
Error1: ERROR1:
The driver is not executable: /usr/bin/chromedriver
to correct I made it executable using sudo 777 chromedriver
then I got The driver is not executable: /usr/bin/chromedriver
要更正我使用sudo 777 chromedriver
使其可执行然后我得到了
Error2: 误差2:
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
to fix this I updated selenium jar dependencies
to 2.40.0
and since then, I've been getting org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
以解决此问题我更新了selenium jar dependencies
到2.40.0
,从那时起,我一直在
Error3: 误差3:
java.lang.NoClassDefFoundError: org/openqa/selenium/HasInputDevices
Query: Now I know that HasInputDevices
has been moved to org/openqa/selenium/Interactions/
then why it is still looking in old directory path org/openqa/selenium/HasInputDevices
. 查询:现在我知道HasInputDevices
已被移动到org/openqa/selenium/Interactions/
然后它仍然在寻找旧的目录路径org/openqa/selenium/HasInputDevices
。 How to let it find at its actual directory. 如何让它找到它的实际目录。
1. I have updated dependencies. 1.我已更新依赖项。
2. I have tried to use mvn install
so that it download what is written in pom.xml
2.我尝试使用mvn install
以便下载pom.xml
but it's looking in old directory. 但它正在寻找旧目录。
How to resolve this error, I don't want to downgrade selenium APIs, because then Chrome exits unexpectedly. 如何解决此错误,我不想降级selenium API,因为Chrome意外退出。
Had a similar problem, getting ClassCastException where HasInputDevices was incompatible with FirefoxDriver. 有一个类似的问题,获得ClassCastException HasInputDevices与FirefoxDriver不兼容。
Solved by changing the import to another package: From 通过将导入更改为另一个包解决: 来自
import org.openqa.selenium.Mouse; import org.openqa.selenium.Mouse;
To 至
import org.openqa.selenium.interactions.Mouse; import org.openqa.selenium.interactions.Mouse;
The exact error stack I encountered was: 我遇到的确切错误堆栈是:
java.lang.ClassCastException: org.openqa.selenium.firefox.FirefoxDriver cannot be cast to org.openqa.selenium.interactions.HasInputDevices. java.lang.ClassCastException:org.openqa.selenium.firefox.FirefoxDriver无法强制转换为org.openqa.selenium.interactions.HasInputDevices。
我有同样的问题和解决方法是下一步:从POM.xml中删除所有未使用的依赖项,例如,如果你只使用FirefoxDriver,在POM.xml中有另一个(Chrome,Common,remote)删除它们
I found the solution which worked for me. 我找到了适合我的解决方案。 I was using a dependency which had a transitive dependency on selenium-remote-driver version 2.34.0, remove this dependency and it will work.This dependency was: 我使用的依赖项对selenium-remote-driver版本2.34.0具有传递依赖性,删除此依赖项并且它将起作用。这种依赖关系是:
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.