Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
608 views
in Technique[技术] by (71.8m points)

java - "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. I have installed latest Chrome on that server but I've been getting these errors,when I used this:

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

Error1:
The driver is not executable: /usr/bin/chromedriver to correct I made it executable using sudo 777 chromedriver then I got
Error2:

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
Error3:
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. How to let it find at its actual directory.
1. I have updated dependencies.
2. I have tried to use mvn install so that it download what is written in 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Had a similar problem, getting ClassCastException where HasInputDevices was incompatible with FirefoxDriver.

Solved by changing the import to another package: From

import org.openqa.selenium.Mouse;

To

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...