appium / java-client

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

Unable to start Appium session when I am having sikulixapi: 2.0.5 added in the dependency. #2020

Open JYOTIPRAKASH225 opened 1 year ago

JYOTIPRAKASH225 commented 1 year ago

Description

Unable to start Appium session when I am having sikulixapi: 2.0.5 added in the dependency.

Environment

Details

Unable to start Appium session when I am having sikulixapi: 2.0.5 added in the dependency. Note: I am able create session when I downgrade sikulixapi to 2.0.4.

This is the dependency added to pom.xml

com.sikulix sikulixapi 2.0.5

Code To Reproduce Issue [ Good To Have ]

    service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1")
            .usingPort(port).withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js"))
            .withArgument(GeneralServerFlag.LOG_LEVEL, "debug")
            .withLogFile(new File(System.getProperty("user.dir") + "appium.log"))
            .withArgument(GeneralServerFlag.RELAXED_SECURITY));
    DesiredCapabilities capabilities = new DesiredCapabilities();

    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
    capabilities.setCapability("appium:platformVersion", "15");
    capabilities.setCapability("appium:deviceName", "jyotipraksh's iPhone");
    capabilities.setCapability("appium:automationName", "XCUITest");
    capabilities.setCapability("appium:app", "com.fiberlink.maas360.enterpriseappstore");
    capabilities.setCapability("appium:udid", "6279765bfc1744548bec50ddc00780049a3f155c");
    capabilities.setCapability("appium:includeSafariInWebviews", true);
    capabilities.setCapability("appium:newCommandTimeout", 3600);
    capabilities.setCapability("appium:connectHardwareKeyboard", true);

    System.out.println("Appium context set to application :" + appName);
    driver = new IOSDriver(service, capabilities);

Exception Stacktraces

(https://gist.github.com/JYOTIPRAKASH225/f72cdde390c92d22df812edf09538e0d)

Link To Appium Logs

[Appium] Welcome to Appium v2.1.3 [Appium] Non-default server args: [Appium] { address: '127.0.0.1', port: 4385, relaxedSecurityEnabled: true } [Appium] Attempting to load driver xcuitest... [debug] [Appium] Requiring driver at /Users/jprakash/.appium/node_modules/appium-xcuitest-driver [Appium] Appium REST http interface listener started on http://127.0.0.1:4385 [Appium] Available drivers: [Appium] - xcuitest@5.1.0 (automationName 'XCUITest') [Appium] Available plugins: [Appium] - execute-driver@3.0.14 [Appium] - device-farm@8.2.1 [Appium] - appium-dashboard@v2.0.2 [Appium] No plugins activated. Use the --use-plugins flag with names of plugins to activate [HTTP] --> GET /status [HTTP] {} [debug] [AppiumDriver@132e] Calling AppiumDriver.getStatus() with args: [] [debug] [AppiumDriver@132e] Responding to client with driver.getStatus() result: {"ready":true,"message":"The server is ready to accept new connections","build":{"version":"2.1.3"}} [HTTP] <-- GET /status 200 9 ms - 110 [HTTP] org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Host info: host: 'jprakashs-MacBook-Pro-2098.local', ip: '2402:e280:217b:ac5:b98e:5649:bd6c:fb24%en0' at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:274) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:163) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:89) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:112) at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:126) at com.appium.appium2Session.getDriver(appium2Session.java:61) at com.appium.appium2Session.main(appium2Session.java:30) Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException Build info: version: '4.12.1', revision: '8e34639b11' System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.4.1', java.version: '17.0.8' Driver info: driver.version: IOSDriver at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:137) at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:102) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:182) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602) ... 7 more Caused by: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:133) ... 11 more Caused by: java.lang.NoClassDefFoundError: io/netty/handler/codec/DefaultHeaders$ValueValidator at org.asynchttpclient.RequestBuilderBase.(RequestBuilderBase.java:98) at org.asynchttpclient.RequestBuilderBase.(RequestBuilderBase.java:92) at org.asynchttpclient.RequestBuilder.(RequestBuilder.java:35) at org.asynchttpclient.RequestBuilder.(RequestBuilder.java:31) at org.asynchttpclient.Dsl.request(Dsl.java:73) at org.openqa.selenium.remote.http.netty.NettyMessages.toNettyRequest(NettyMessages.java:57) at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:55) at io.appium.java_client.AppiumUserAgentFilter.lambda$apply$0(AppiumUserAgentFilter.java:88) at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:55) at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:48) at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:96) at io.appium.java_client.remote.AppiumCommandExecutor.lambda$null$0(AppiumCommandExecutor.java:187) at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:55) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:115) ... 16 more Caused by: java.lang.ClassNotFoundException: io.netty.handler.codec.DefaultHeaders$ValueValidator at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 30 more Exception : Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Host info: host: 'jprakashs-MacBook-Pro-2098.local', ip: '2402:e280:217b:ac5:b98e:5649:bd6c:fb24%en0'

ashwithpoojary98 commented 1 year ago

@JYOTIPRAKASH225 try the following code, Add base Path to the builder argument

new AppiumServiceBuilder() .usingAnyFreePort() .withArgument(GeneralServerFlag.BASEPATH, "/wd/hub") .build() .start();

JYOTIPRAKASH225 commented 1 year ago

@ashwithpoojary98 : .withArgument(GeneralServerFlag.BASEPATH, "/wd/hub") adding this will fail. I am using Appium 2.0 There is some issue with sikulixapi: 2.0.5 When I downgrade to 2.0.4, everything works fine.

ashwithpoojary98 commented 1 year ago

@JYOTIPRAKASH225 What is the JDK version that you are using? if below 11 update it!!

JYOTIPRAKASH225 commented 1 year ago

I am using JDK 17

JYOTIPRAKASH225 commented 1 year ago

@jlipps : Can you please suggest here? There is a lot of dependency for sikulixapi in my project. When I downgrade to 2.0.4 from 2.0.5, everything works fine. Please look into it and suggest.

ashwithpoojary98 commented 1 year ago

@JYOTIPRAKASH225 The common dependencies might be mismatched, so try removing the common dependency from SikuliXAPI.