Wrt Grid: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible (Selenium Server 3.14,Java Client 6.1.0)


#1

Hello,
As practise I did the configuration of grid,nodes following forums
However I am not able to run cases… Getting the error as metioned in subject.
Did find the below link but cannot proceed… I did clean followed by update maven dependency

Below is the error log,pom,testng and capabilities details.
Sir @Aleksei , @KazuCocoa can anyone please advise…

Also why in logs I see capabilities as 5001:systemport
I am under impression that it is name value and here I see value:name
Please let me know if I misread this or I have done something wrong.

org.openqa.selenium.WebDriverException: It is impossible to create a new session because ‘createSession’ which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: ‘3.141.5’, revision: ‘d54ebd709a’, time: ‘2018-11-06T11:42:16’
System info: host: ‘’, ip: ‘192.168.56.1’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_161’
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:93)
at InitBase.BaseClass.initAppium(BaseClass.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:185)
… 28 more
Caused by: org.openqa.selenium.WebDriverException: Unable to parse remote response:

Error 500 Server Error

HTTP ERROR 500

Problem accessing /wd/hub/session. Reason:

    Server Error

Caused by:

java.io.IOException: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {

Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [5.1.1, 5000, 7e6faae4, Android]
at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$5(NewSessionPayload.java:197)
POM
Capabilities
TestNG


#2

Did you try the latest appium java client? You need to get it via jitpack, so far.

Could you try the latest one first if you have not tried it yet?


#3

We do not use grid but init appium servers on machine we starting tests. We use parallel type “methods”. You driver should be thread safe ( we use as threadlocal). All variables that specific to threads are also thread safe. Few places are synchronized.


#4

Thanks @Aleksei I am not sure on this approach but would like to try… do you have reference link for same as I can learn.


#5

I think the way is like below. Launch multiple appium servers on local and create sessions for them. We can control sessions connecting to http://127.0.0.1:4723/wd/hub or http://127.0.0.1:4725/wd/hub. Then, you need to take care of port conflicts.

$ appium -p 4723 # Appium server communicate with `4723` port
$ appium -p 4725 # Appium server communicate with `4725` port

http://appium.io/docs/en/writing-running-appium/server-args/


What selenium grid did you try? I have tested them with https://github.com/appium/ruby_lib/tree/master/grid before. (2.53 ~ 3.14.0) I will take a look the cause.


#6

@KazuCocoa I had tried this
java -jar selenium-server-standalone-3.13.0.jar -role hub


#7

@KazuCocoa as I understand as I read forums in my json I ha given as below
http://127.0.0.1:5000/wd/hub"
where 5000 was my server instance port
Similarly I had done
http://127.0.0.1:5001/wd/hub"


#8

@vsharma remember! Each appium server accept own appium port should have dirrerent other set of ports depending on platform you are using: iOS or Android.

E.g. “bootstrap-port” port for Android.


#9

@Aleksei as read on forums when launching appium server instance I did define different BP in my case for lenevo it was 4724 or is it something else ur referring too?
Motorola 4275
BP


#10

@KazuCocoa in the logs I also see the following
20:21:20.520 WARN [DefaultGridRegistry.removeIfPresent] - Cleaning up stale test sessions on the unregistered node http://127.0.0.1:5000
2018-12-24 20:22:30.096:WARN:osjs.HttpChannel:qtp1846412426-12: /wd/hub/session java.io.IOException: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
“desiredCapabilities”: {

I am unclear how the values are read?
eg:- I see in logs as
“7e6faae4”: “udid”,
in capabilities they are defiened as
“udid” :“7e6faae4”:
Is this correct?

Also tried the below link by performing maven clean >install > test but still the same.
https://stackoverflow.com/questions/51084484/org-openqa-selenium-json-jsonoutput-writeljava-lang-objectljava-lang-reflect-t

Something wrong in my capabilties?


Capabilities
testngxml


#11

Yes, as you addressed, "7e6faae4": “udid”, should be "udid" :“7e6faae4”.

"5.1.1": "systemPort",
"5000": "platform"
"7xxxxx": "udid"
"Android": "platformVersion"

must be:

"systemPort": "5000",
"platform": "Android",
"platformVersion": "5.1.1",
"udid": "7xxxxx"

Do you have any chance to try out newer grid?
If the bug is in grid server, it probably works after 3.14.0
(I tested with the version before. Then, it create session was succeeded.)


#12

@KazuCocoa I tried with 3.141.59
Also included

org.seleniumhq.selenium
selenium-server
3.141.59

Updated Java to 11 then some compiler maven issues resolved but still the same
I am blocked :frowning:
Which version worked for you? May be I will downgrade but I need to keep Java 6.1.0


#13

Did you already try the lates Java client via jitpack? It is not 6.1.0 from maven. (We have an issue to publish the library, so we currently use jitpack as a workaround.) Please follow the repository’s readme to install it via jitpack.

If the cause is selenium grid’s parsing capability issue, the latest Java-client has the fix.


BTW, I tested with https://github.com/appium/ruby_lib/tree/master/grid . The ruby version also has the same fix with issue#1010 in Java client.


#14

Hi @KazuCocoa
I did download the same
https://jitpack.io/#appium/java-client/0cb3fcbd54
com.github.appium
java-client
0cb3fcbd54
But still the same… :frowning:


#15

thanks. Can you create an issue on the client repository?
Please do not forget to attach appium logs and your code set the capability and create a session.

I need to investigate the cause.
(Or if other members know the reason, they also can help it.)


#16

@KazuCocoa client repo?
Can you please share me the url as I am not aware…
Also should I share this discussion link there too?


#17

https://github.com/appium/java-client is.
Yes, it is helpful to catch up with the issue > link


#18

I tried to run https://github.com/appium/java-client/blob/1991a8a0f9e4a3ff467dbb713cb5c51c8edc060f/src/test/java/io/appium/java_client/ios/IOSDriverTest.java with 3.13.0, 3.14 and 3.141.59. 3.13 and 3.14 succeeded to run. 3.141.59 had an issue in probably grid side? (have not investigated though). The grid configuration was he same as ruby_core’s one I attached the above.

[HTTP] --> GET /wd/hub/status
[HTTP] {}
[debug] [GENERIC] Calling AppiumDriver.getStatus() with args: []
[debug] [GENERIC] Responding to client with driver.getStatus() result: {"build":{"version":"1.11.0-beta.2","git-sha":"e793e279f91217301e809e5deaad0b85ce0c3802","built":"2018-12-21 17:20:20 -0500"}}
[HTTP] <-- GET /wd/hub/status 200 1 ms - 164
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"app":"/Users/kazu/GitHub/java-client/src/test/java/io/appium/java_client/TestApp.app.zip","server:CONFIG_UUID":"41d25297-cc13-49cc-ad8a-8b78ac18f327","platformVersion":"11.4","automationName":"XCuiTest","platformName":"ios","deviceName":"iPhone X","launchTimeout":500000},"capabilities":{"firstMatch":[{"platformName":"ios","server:CONFIG_UUID":"41d25297-cc13-49cc-ad8a-8b78ac18f327"}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"app":"/Users/kazu/GitHub/java-client/src/test/java/io/appium/java_client/TestApp.app.zip","server:CONFIG_UUID":"41d25297-cc13-49cc-ad8a-8b78ac18f327","platformVersion":"11.4","automationName":"XCuiTest","platformName":"ios","deviceName":"iPhone X","launchTimeout":500000},null,{"firstMatch":[{"platformName":"ios","server:CONFIG_UUID":"41d25297-cc13-49cc-ad8a-8b78ac18f327"}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1545836171483 (23:56:11 GMT+0900 (Japan Standard Time))
[Appium] Could not parse W3C capabilities: 'deviceName' can't be blank
[Appium] Trying to fix W3C capabilities by merging them with JSONWP caps
[BaseDriver] The capabilities ["app","platformVersion","automationName","deviceName","launchTimeout"] are not standard capabilities and should have an extension prefix
[Appium] Creating new XCUITestDriver (v2.104.0) session
[Appium] Capabilities:
[Appium]   app: /Users/kazuaki/GitHub/java-client/src/test/java/io/appium/java_client/TestApp.app.zip
[Appium]   platformVersion: 11.4
[Appium]   automationName: XCuiTest
[Appium]   deviceName: iPhone X
[Appium]   launchTimeout: 500000
[Appium]   platformName: ios
[Appium]   server:CONFIG_UUID: 41d25297-cc13-49cc-ad8a-8b78ac18f327
[debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"appium:app... and MJSONWP desired capabilities {"app":"/Users/kazuaki/GitH... were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"appium:app...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: server:CONFIG_UUID.
[BaseDriver] Session created with session id: d1173cec-ecea-432b-b530-3ec659d56d08
[debug] [XCUITest] Current user: 'kazuaki'
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[debug] [GENERIC] Calling AppiumDriver.getStatus() with args: []

The above was a part of Appium log which was registered with the grid. Appium clients worked well.

I noticed capabilities you attached in https://discuss-new.appium.io/uploads/default/original/2X/f/fe7545f06f408ed5e9cd3486ec08f76820745d84.JPG was grid side. What capability can you see in http://localhost:4444/grid/console ? Was it correct?


#19

@KazuCocoa
Yes it looks ok localhost

Do let me know if anything else is required…Morning i will raise ticket once you give nod.


#20

@KazuCocoa today I tried again this time I added device name in parameter and did a rerun…
I see some other exception in logs
the value “appium:udid”: “ZY2235F2FB”, is displayed as expected in logs though… but there is exception

2018-12-27 16:39:53.673:WARN:osjs.HttpChannel:qtp510464020-12: /wd/hub/session java.io.IOException: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
“desiredCapabilities”: {
“app”: “C:\Users\vaibhav.sharma\Latest WorkSpace\IDIAutomation\src\main\abcd.apk”,
“appActivity”: “abc”,
“appPackage”: “abc”,
“autoGrantPermissions”: “true”,
“platformName”: “Android”,
“udid”: “ZY2235F2FB”,
“deviceName”: “Motorola”,
“fullReset”: “false”,
“version”: “6.0.1”,
“platform”: “ANDROID”,
“systemPort”: “5001”
},
“capabilities”: {
“firstMatch”: [
{
“appium:app”: “C:\Users\vaibhav.sharma\Latest WorkSpace\IDIAutomation\src\main\abcd.apk”,
“appium:appActivity”: “”,
“appium:appPackage”: “”,
“appium:autoGrantPermissions”: “true”,
“appium:deviceName”: “Motorola”,
“appium:fullReset”: “false”,
“platform”: “ANDROID”,
“platformName”: “android”,
“appium:systemPort”: “5001”,
“appium:udid”: “ZY2235F2FB”,
“version”: “6.0.1”
}
]
}

org.openqa.selenium.WebDriverException: java.lang.NullPointerException
Build info: version: ‘3.141.5’, revision: ‘d54ebd709a’, time: ‘2018-11-06T11:42:16’
System info: host: ‘VAIBHAVS-LAPTOP’, ip: ‘192.168.56.1’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_51’
Driver info: driver.version: unknown
at io.appium.java_client.pagefactory.AppiumElementLocator$WaitingFunction.apply(AppiumElementLocator.java:192)
at io.appium.java_client.pagefactory.AppiumElementLocator$WaitingFunction.apply(AppiumElementLocator.java:1)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249)
at io.appium.java_client.pagefactory.AppiumElementLocator.waitFor(AppiumElementLocator.java:99)
at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:119)
at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(InterceptorOfASingleElement.java:59)
at org.openqa.selenium.remote.RemoteWebElement$$EnhancerByCGLIB$$d27c0df4.getText()
at TestCases.Smoke.StartEkyc(Smoke.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at io.appium.java_client.pagefactory.AppiumElementLocator.lambda$0(AppiumElementLocator.java:120)
at io.appium.java_client.pagefactory.AppiumElementLocator$$Lambda$214/1013481204.get(Unknown Source)
at io.appium.java_client.pagefactory.AppiumElementLocator$WaitingFunction.apply(AppiumElementLocator.java:172)
… 20 more
Devicename