appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.2k stars 753 forks source link

bug: AppiumFluentWait -> Cannot access org.openqa.selenium.support.ui.FluentWait #2012

Closed AlessandroMiccoli closed 11 months ago

AlessandroMiccoli commented 11 months ago

Description

I am trying to use AppiumFluentWait. Previously, with the version 7.6.0, I was able to do

new AppiumFluentWait<AppiumDriver<?>>(appiumDriver)
                .withTimeout(Duration.ofMillis(maxWait))
                .pollingEvery(Duration.ofMillis(interval))
                .ignoring(NoSuchElementException.class)
                .ignoring(TimeoutException.class)
                .until(ExpectedConditions.visibilityOfElementLocated(by));

With version 8.5.1, I got: Cannot access org.openqa.selenium.support.ui.FluentWait when I try to use AppiumFluentWait.

Is it a bug or I am missing something for this implementation?

mykola-mokhnach commented 11 months ago

Most likely something has been changed in selenium so the reflection access is broken now and needs to be updated. So yeah, lets assume it is a bug

mykola-mokhnach commented 11 months ago

Please provide the full stacktrace as well

AlessandroMiccoli commented 11 months ago

Sorry for my late reply. This is a screenshot that summarises the problem.

Screenshot 2023-09-15 at 16 20 22

Temporary fix

Add the dependency to your project -> implementation 'org.seleniumhq.selenium:selenium-support:4.8.3'

Fix to appium

Add this to the build.gradle

api ('org.seleniumhq.selenium:selenium-support') {
    version {
        strictly "[${seleniumVersion}, 5.0)"
        prefer "${seleniumVersion}"
    }
}

Let me know if it makes sense for you, so I will create a PR.

mykola-mokhnach commented 11 months ago

@valfirst @SrinivasanTarget Are you able to reproduce the above issue?

ashwithpoojary98 commented 11 months ago

@AlessandroMiccoli it's working fine new AppiumFluentWait<>(appiumDriver) .withTimeout(Duration.ofMillis(maxWait)) .pollingEvery(Duration.ofMillis(interval)) .ignoring(NoSuchElementException.class) .ignoring(TimeoutException.class) .until(ExpectedConditions.visibilityOfElementLocated(by));

saikrishna321 commented 11 months ago

@mykola-mokhnach I'm unable to reproduce this problem. Using the latest java-client

AlessandroMiccoli commented 11 months ago

@ashwithpoojary98 are you using io.appium:java-client:8.5.1 without implementing separately org.seleniumhq.selenium:selenium-support:4.8.3? If yes, on my IntelliJ I don't see selenium-support in the compile classpath:

Screenshot 2023-09-19 at 13 30 31

Could you provide me with the whole implementation with the import, etc...

In fact, the appium library has this build.gradle:

    api ('org.seleniumhq.selenium:selenium-api') {
        version {
            strictly "[${seleniumVersion}, 5.0)"
            prefer "${seleniumVersion}"
        }
    }
    api ('org.seleniumhq.selenium:selenium-remote-driver') {
        version {
            strictly "[${seleniumVersion}, 5.0)"
            prefer "${seleniumVersion}"
        }
    }
    implementation ('org.seleniumhq.selenium:selenium-support') {
        version {
            strictly "[${seleniumVersion}, 5.0)"
            prefer "${seleniumVersion}"
        }
    }

There is not api for org.seleniumhq.selenium:selenium-support.

ashwithpoojary98 commented 11 months ago

@AlessandroMiccoli I'm using Appium client 8.5.1

AlessandroMiccoli commented 11 months ago

@AlessandroMiccoli I'm using Appium client 8.5.1

@ashwithpoojary98 I am using the same.

Do you import org.seleniumhq.selenium:selenium-support:4.8.3 separately in your project? Do you manipulate the import of io.appium:java-client:8.5.1 in some ways?

Please, could you share your code on git?