"HasInputDevices" is located in "/ org / openqa / selenium / interactions", but it still looks at "/ org / openqa / selenium /"

I want to run WebDriver test cases on Chrome on a remote Ubuntu server. I installed the latest Chrome on this server, but I get 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 fix 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 get Error3:
java.lang.NoClassDefFoundError: org/openqa/selenium/HasInputDevices
Request: Now I know that HasInputDevices been migrated to org/openqa/selenium/Interactions/ , and then why is it still looking for the path of the old org/openqa/selenium/HasInputDevices . How to find it in your actual directory.
1. I have updated dependencies.
2. I tried using mvn install to download what is written in pom.xml
but it looks in the old directory.
How to resolve this error, I do not want to lower the selenium APIs, because then Chrome unexpectedly quits.

+3
source share
3 answers

There was a similar problem getting a ClassCastException where HasInputDevices is incompatible with FirefoxDriver.

Solved by changing the import to another package: C

import org.openqa.selenium.Mouse;

For

import org.openqa.selenium.interactions.Mouse;

The exact error stack I came across was:

java.lang.ClassCastException: org.openqa.selenium.firefox.FirefoxDriver could not be passed to org.openqa.selenium.interactions.HasInputDevices.

+1
source

I had the same problem, and the way to solve it was as follows: remove all unused dependencies from POM.xml for example, if u uses only FirefoxDriver and in POM.xml there is another (Chrome, Common, remote) delete them

+1
source

I found a solution that worked for me. I used a dependency that had a transitive dependency on selenium-remote-driver version 2.34.0, removes this dependency, and it will work. This dependency was:

 <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> 
0
source

Source: https://habr.com/ru/post/1502389/


All Articles