Selenium grid selects device nodes randomly

The problem

I am trying to set up Grid for running automation on multiple devices both android and IOS. When I run the automation, the test is executed on the device which is specified in the capability. But when I look at the hub log, there is a difference in the selection of the node, where, the node requested and the one assigned are different. Please look at the logs for more details. Do let me know if there are any more configurations that needs to be added.

Expected behaviour
Select the test slot for the node specified

Actual behaviour
Any available node is selected

Environment

Appium version (or git revision) that exhibits the issue: 1.8.1
Last Appium version that did not exhibit the issue (if applicable):
Desktop OS/version used to run Appium:
Node.js version (unless using Appium.app|exe):
Mobile platform/version under test: Android 7.0
Real device or emulator/simulator: Real device
Appium CLI or Appium.app|exe: CLI
Environment - MAC OS
Appium java-client - 6.1.0
Details

 Created two nodes and connect it to selenium hub running on 3.14. Requested one device by passing deviceName, udid capability.

Appium logs

Hub logs
07:01:28.406 INFO - Got a request to create a new session: Capabilities {app: appPath, appActivity: appActivity, appPackage: appPackage, autoGrantPermissions: true, automationName: uiautomator2, deviceName: Android, newCommandTimeout: 45000, platformName: android, udid: ZY2244JGLL, webDriverAgentUrl: locahost:8100}

07:01:28.406 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, se:CONFIG_UUID=92f5e8b9-0f62-49a7-a18c-dab1649f3dc0, browserName=chrome, maxInstances=1, platformName=Android, deviceName=54f81e687d93, version=7.0, platform=ANDROID}

Node1 config

{
“capabilities”:
[
{
“browserName”: “ZY2244JGLL”,
“version”:“7.0”,
“maxInstances”: 1,
“platform”:“ANDROID”,
“seleniumProtocol”:“WebDriver”,
“deviceName”:“ZY2244JGLL”,
“udid”:“ZY2244JGLL”
}
],
“configuration”:
{
“cleanUpCycle”:240,
“timeout”:240,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://localhost:4444/wd/hub”,
“host”: “localhost”,
“port”: 4627,
“maxSession”: 1,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “localhost”,
“role”:“node”,
“unregisterIfStillDownAfter”:6000,
“downPollingLimit”:2,
“nodeStatusCheckTimeout”:500,
“nodePolling”:500
}
}

Node1 start command
appium --address localhost --port 4627 -bp 8783 --nodeconfig pathOfConfigFile --session-override

Node2 config

{
“capabilities”:
[
{
“browserName”: “54f81e687d93”,
“version”:“7.0”,
“maxInstances”: 1,
“platform”:“ANDROID”,
“seleniumProtocol”:“WebDriver”,
“deviceName”:“54f81e687d93”,
“udid”:“54f81e687d93”
}
],
“configuration”:
{
“cleanUpCycle”:240,
“timeout”:240,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://localhost:4444/wd/hub”,
“host”: “localhost”,
“port”: 4628,
“maxSession”: 1,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “localhost”,
“role”:“node”,
“unregisterIfStillDownAfter”:6000,
“downPollingLimit”:2,
“nodeStatusCheckTimeout”:500,
“nodePolling”:500
}
}

Node2 start command
appium --address localhost --port 4628 -bp 8784 --nodeconfig pathOfConfigFile --session-override

follow this post

the capabilities must include: “browserName”, “version”,“platform”, “platformName”, “deviceName”
and the connecting capabilities must be an exact match.

1 Like