Cannot access org.openqa.selenium.interactions.HasInputDevices in Java 8.2 with Selenium 4

Hi all,

Need help on resolving this? I have Java 8.0 appium 1.x project. As appium 2 beta version is released, I started using that . I installed appium 2 beta version and made following changes in Gradle. But when i run that, I’m getting below error in driver i.e java: cannot access org.openqa.selenium.interactions.HasInputDevices. Anybody please check my gradle and help me to resolve this?
Also , please suggest changing existing project from appium 1.x to appium 2 is it good idea?

Error:
java: cannot access org.openqa.selenium.interactions.HasInputDevices
class file for org.openqa.selenium.interactions.HasInputDevices not found

Class Name: AppiumPageObject
public WebDriver facade = getDriver();
public WebDriver driver = ((WebDriverFacade) facade).getProxiedDriver();. --> Cursor is pointing to this line.

public AppiumPageObject() {  // This is to use one page to another

}

build.gradle:

dependencies {
implementation ‘io.cucumber:cucumber-java:6.9.1’
implementation ‘net.serenity-bdd:serenity-stats:2.3.12’
implementation ‘cglib:cglib:3.3.0’
implementation ‘org.apache.commons:commons-lang3:3.8.1’
implementation ‘org.seleniumhq.selenium:selenium-api:4.6.0’

implementation 'org.seleniumhq.selenium:selenium-java:4.6.0'

implementation 'org.seleniumhq.selenium:selenium-remote-driver:4.6.0'

implementation 'org.seleniumhq.selenium:selenium-support:4.6.0'
implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.6.0'

implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.3'
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.3'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.3'
implementation 'net.serenity-bdd:serenity-single-page-report:2.3.12'
implementation 'com.opencsv:opencsv:5.1'
implementation 'io.appium:java-client:8.2.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.12.3'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.12.3'
implementation 'org.slf4j:slf4j-log4j12:2.0.4'

https://stackoverflow.com/questions/48718198/error-cannot-access-org-openqa-selenium-hasinputdevices-class-file-not-found

Thanks Wreed. Yeah, I saw this but Selenium 3 version doesn’t go well with Appium 2 beta version.And I wanna use selenium 4 .

Well at least you know it’s a setup issue. How you resolve it is up to you.

Might be similar to this:

I had the same issue with the same java-client version(8.2.0) and updating to java-client 8.3.0 did the job.

Thank you… Yeah, that’s correct I changed following jar version. After that I’m not getting that issue, it’s compatible issue. But getting below one.
net.thucydides.core.pages.WrongPageError at PageFactory.java:103

dependencies {
implementation ‘io.cucumber:cucumber-java:7.8.1’
implementation ‘io.cucumber:cucumber-core:7.8.1’
implementation ‘net.serenity-bdd:serenity-stats:3.6.9’
implementation ‘net.serenity-bdd:serenity-single-page-report:3.6.9’
implementation ‘net.serenity-bdd:serenity-core:3.6.9’

implementation 'cglib:cglib:3.3.0'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.seleniumhq.selenium:selenium-api:3.9.1'

implementation 'io.appium:java-client:8.3.0'
implementation 'org.seleniumhq.selenium:selenium-java:4.7.0'
implementation 'org.seleniumhq.selenium:selenium-remote-driver:4.7.0'
implementation 'org.seleniumhq.selenium:selenium-support:4.7.0'
implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.7.0'

implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4'
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.4'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.4'

implementation 'com.opencsv:opencsv:5.1'

implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.12.3'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.12.3'
implementation 'org.slf4j:slf4j-log4j12:2.0.5'
compileOnly  'org.projectlombok:lombok:1.18.24'
implementation 'com.googlecode.lambdaj:lambdaj:2.3.3'

testImplementation 'net.serenity-bdd:serenity-junit:3.6.9'

// testImplementation ‘net.serenity-bdd:serenity-cucumber6:2.6.0’
testImplementation ‘net.serenity-bdd:serenity-cucumber:3.6.9’
testImplementation ‘net.serenity-bdd:serenity-screenplay:2.4.34’
testImplementation ‘net.serenity-bdd:serenity-screenplay-webdriver:2.4.34’
testImplementation ‘junit:junit:4.13.2’

testImplementation 'org.assertj:assertj-core:3.22.0'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'com.saucelabs:saucerest:1.2.0'
annotationProcessor 'org.projectlombok:lombok:1.18.24'

}