appium / java-client

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

Error Attempting To Start Appium Programmatically with Version 9.0.0, Repeat of Issue 1907 #2101

Closed Warren25 closed 8 months ago

Warren25 commented 8 months ago

Description

Getting Receiver class java.lang.AbstractMethodError: Receiver class io.appium.java_client.service.local.AppiumServiceBuilder does not define or inherit an implementation of the resolved method 'abstract void loadSystemProperties()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder. error while initiating AppiumDriverLocalService.

I believe this issue to be directly related to https://github.com/appium/java-client/issues/1907#issue-1701376176

Environment

Details

_I am using appium java client 9.0.0 since it is the latest and also 8.5.0 seems to not be recognized as a valid dependency in Maven.

Code fails at line where AppiumDriverLocalService is invoked._

Code To Reproduce Issue [ Good To Have ]

public static void startAppiumServer() {
        AppiumServiceBuilder builder = new AppiumServiceBuilder();
        builder.withIPAddress("127.0.0.1")
                .usingPort(4723)
                .withArgument(BASEPATH, "wd/hub")
                .withArgument(SESSION_OVERRIDE)
                .withArgument(LOG_LEVEL, "info");

        service = AppiumDriverLocalService.buildService(builder);

        try {
            service.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Exception Stacktraces

Step failed
java.lang.AbstractMethodError: Receiver class io.appium.java_client.service.local.AppiumServiceBuilder does not define or inherit an implementation of the resolved method 'abstract void loadSystemProperties()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder.
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:495)
    at io.appium.java_client.service.local.AppiumDriverLocalService.buildService(AppiumDriverLocalService.java:90)
    at utils.AppiumServerController.startAppiumServer(AppiumServerController.java:21)
    at tests.SampleTest.test(SampleTest.java:24)
valfirst commented 8 months ago

@Warren25 how do you specify the version of Appium client?

Warren25 commented 8 months ago

@valfirst

Here is where I list the Appium Java client in my pom file

image

valfirst commented 8 months ago

Please make sure to use compatible version of Appium Java client and Selenium client: https://github.com/appium/java-client?tab=readme-ov-file#compatibility-matrix

valfirst commented 8 months ago

Serenity also uses own range of Appium and Selenium versions: https://github.com/serenity-bdd/serenity-core/blob/fc35b519bc57595eb9a29e65994aad55317596e8/pom.xml#L65-L76, make sure your classpath doesn't contain any incompatible JAR-s

valfirst commented 8 months ago

Duplicate of #1907