appium / java-client

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

java.lang.NoSuchMethodError: 'org.openqa.selenium.remote.http.HttpClient$Factory org.openqa.selenium.remote.http.HttpClient$Factory.createDefault()' #1989

Closed Alekhya2533 closed 12 months ago

Alekhya2533 commented 1 year ago

Description

Using Java 11, Selenium-Java 4.8.1 , Appium Java client 8.3.0. i am facing the below error. Here i am attaching my pom.xml

java.lang.NoSuchMethodError: 'org.openqa.selenium.remote.http.HttpClient$Factory org.openqa.selenium.remote.http.HttpClient$Factory.createDefault()' at io.appium.java_client.remote.AppiumCommandExecutor.(AppiumCommandExecutor.java:108) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:92) at com.c0deattack.cucumberspring.ConfigSetUp.setUpBrowswerStackForYardApp(ConfigSetUp.java:762) at com.c0deattack.cucumberspring.Hooks.launchYardAppOnBrowserStack(Hooks.java:455) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at cucumber.runtime.Utils$1.call(Utils.java:37) at cucumber.runtime.Timeout.timeout(Timeout.java:13) at cucumber.runtime.Utils.invoke(Utils.java:31) at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:59) at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:222) at cucumber.runtime.Runtime.runHooks(Runtime.java:210) at cucumber.runtime.Runtime.runBeforeHooks(Runtime.java:200) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44) at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91) at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63) at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at cucumber.api.junit.Cucumber.run(Cucumber.java:98) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)

LatestPom.txt

Here is the desired capabilities i am using

DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability("browserstack.user", browserStackUserName); caps.setCapability("browserstack.key", browserStackKey); caps.setCapability("device", device); caps.setCapability("os_version", version); caps.setCapability("project", "YardApp"); caps.setCapability("build", scenario.getName() + "-" + Generic.getDateTimeWithPlusMinutes(0, "dd/MM/yyyy HH:mm")); caps.setCapability("name", "YardAppStage"); caps.setCapability("app", Helper.getValueFromUtilityFile("YardAppURL_Stage")); caps.setCapability("browserstack.idleTimeout", "300"); caps.setCapability("autoGrantPermissions", "true"); caps.setCapability("browserstack.debug", "true");

        try {
            driver.mobileInstance2 = new AppiumDriver(new URL("https://" + browserStackUserName + ":"
                    + browserStackKey + "@hub-cloud.browserstack.com/wd/hub"), caps);

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(e.getMessage());
        }
valfirst commented 1 year ago

pom2.txt

specifies another versions:

        <selenium.version>3.141.59</selenium.version>
        <appium.version>8.1.1</appium.version>

Most likely Selenium 3 and Appium Java Client 8 are not compatible

Alekhya2533 commented 1 year ago

pom2.txt

specifies another versions:

        <selenium.version>3.141.59</selenium.version>
        <appium.version>8.1.1</appium.version>

Most likely Selenium 3 and Appium Java Client 8 are not compatible

LatestPom.txt

Apologies, my pom file in the original issue was not a correct one. Here i am attaching the right one

valfirst commented 1 year ago

LatestPom.txt

contains

    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>5.5.2</version> 
    </dependency>  

which uses the latest Selenium client (4.11.0)

Alekhya2533 commented 1 year ago

Hi, I tried with those versions also. Is the Appium java client version 8.3.0 is the right version for selenium-java 4.11.0 ?

The actual error it is throwing at is at this line, Which is related to appium driver

driver.mobileInstance2 = new AppiumDriver(new URL("https://" + browserStackUserName + ":"

valfirst commented 1 year ago

Is the Appium java client version 8.3.0 is the right version for selenium-java 4.11.0 ?

https://github.com/appium/java-client#compatibility-matrix

Alekhya2533 commented 1 year ago

Hi, I have tried all the possibilities, didnt work for me :-(

valfirst commented 12 months ago

Root cause of the issue: dependencies incompatibility in user's classpath.