Not able to run test in multiple devices by keeping automationName -> uiautomator2

I automated selenium grid for appium expecting to run multiple test in parallel.
Once i was done with the code i started testing it.

I started by passing some sample test blocks with few Xpaths of apps present in playstore. But i hit a wall now.

When i set automationName as Appium both the device executes test parallel .


but its not able to find the xpath mentioned below.

Xpath //[@index=0]

Same if i change automationName to uiautomator2 the above mentioned element is found.


But when the second device tries to start execution unknow server exception is throwed.

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: socket hang up

I’m not able to make any progress. I been testing few things out.
but its a waste of time.

If anyone has gone through this before please help me out.
even suggestions are welcome.


1 Like

@mykola-mokhnach i have set udid capability and also assigned different system ports for appium nodes.

Below is the grid config

When i set capability automationName to uiautomator2 then only second node is not functioning same i tried with Appium it works but the end its having problems to find Xpaths which uiautomator2 is able to do.

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:48’
System info: host: ‘LT0018432’, ip: ‘’, ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘10.0.2’
Driver info:
Capabilities {appActivity: .main.splashscreen.SplashSc…, appPackage:, automationName: UiAutomator2, databaseEnabled: false, desired: {appActivity: .main.splashscreen.SplashSc…, appPackage:, automationName: UiAutomator2, deviceName: 330059b08fd323db, platformName: android, platformVersion: 7.0, udid: 330059b08fd323db}, deviceApiLevel: 24, deviceManufacturer: samsung, deviceModel: SM-A510F, deviceName: 330059b08fd323db, deviceScreenDensity: 480, deviceScreenSize: 1080x1920, deviceUDID: 330059b08fd323db, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 3, platform: LINUX, platformName: Android, platformVersion: 7.0, statBarHeight: 72, takesScreenshot: true, udid: 330059b08fd323db, viewportRect: {height: 1848, left: 0, top: 72, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: bff16013-a90d-4213-95ae-86cfe32da518
*** Element info: {Using=xpath, value=//android.widget.TextView[@text=‘SKIP’]}
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.base/java.lang.reflect.Constructor.newInstance(
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(
at org.openqa.selenium.remote.HttpCommandExecutor.execute(
at io.appium.java_client.remote.AppiumCommandExecutor.execute(
at org.openqa.selenium.remote.RemoteWebDriver.execute(
at io.appium.java_client.DefaultGenericMobileDriver.execute(
at io.appium.java_client.AppiumDriver.execute(
at org.openqa.selenium.remote.RemoteWebDriver.findElement(
at io.appium.java_client.DefaultGenericMobileDriver.findElement(
at io.appium.java_client.AppiumDriver.findElement(
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(
at io.appium.java_client.AppiumDriver.findElementByXPath(
at org.openqa.selenium.By$ByXPath.findElement(
at org.openqa.selenium.remote.RemoteWebDriver.findElement(
at io.appium.java_client.DefaultGenericMobileDriver.findElement(
at io.appium.java_client.AppiumDriver.findElement(
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
at java.base/java.lang.reflect.Method.invoke(
at org.testng.internal.MethodInvocationHelper.invokeMethod(
at org.testng.internal.Invoker.invokeMethod(
at org.testng.internal.Invoker.invokeTestMethod(
at org.testng.internal.Invoker.invokeTestMethods(
at org.testng.internal.TestMethodWorker.invokeTestMethods(
at org.testng.TestRunner.privateRun(
at org.testng.SuiteRunner.runTest(
at org.testng.SuiteRunner.access$000(
at org.testng.SuiteRunner$
at org.testng.internal.thread.ThreadUtil$
at java.base/
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.base/java.util.concurrent.ThreadPoolExecutor$
at java.base/

I cross checked most of the things i’m not able to understand whats causing the issue.

Full Log: (Execution & Node stream buffer)
ExecutionLog.log (201.1 KB)

How to pass default capabilities in new appium version like how he has done below.

I dont see a flag like that now.
[-h] [-v] [–shell] [–allow-cors] [–reboot] [–ipa IPA] [-a ADDRESS]
[-r BACKENDRETRIES] [–session-override] [-l] [-g LOGFILE]
[–log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[–log-timestamp] [–local-timezone] [–log-no-colors] [-G WEBHOOK]
[–safari] [–default-device] [–force-iphone] [–force-ipad]
[–instruments INSTRUMENTSPATH] [–nodeconfig NODECONFIG]
[–chromedriver-port CHROMEDRIVERPORT]
[–chromedriver-executable CHROMEDRIVEREXECUTABLE] [–show-config]
[–no-perms-check] [–strict-caps] [–isolate-sim-device]
[–tmp TMPDIR] [–trace-dir TRACEDIR] [–debug-log-spacing]
[–suppress-adb-kill-server] [–long-stacktrace]
[–webkit-debug-proxy-port WEBKITDEBUGPROXYPORT]
[–enable-heapdump] [–relaxed-security]
[–command-timeout DEFAULTCOMMANDTIMEOUT] [-k]
[–platform-name PLATFORMNAME] [–platform-version PLATFORMVERSION]
[–automation-name AUTOMATIONNAME] [–device-name DEVICENAME]
[–browser-name BROWSERNAME] [–app APP] [-lt LAUNCHTIMEOUT]
[–language LANGUAGE] [–locale LOCALE] [-U UDID]
[–orientation ORIENTATION] [–no-reset] [–full-reset]
[–app-pkg APPPACKAGE] [–app-activity APPACTIVITY]
[–app-wait-package APPWAITPACKAGE]
[–app-wait-activity APPWAITACTIVITY]
[–device-ready-timeout DEVICEREADYTIMEOUT]
[–android-coverage ANDROIDCOVERAGE] [–avd AVD] [–avd-args AVDARGS]
[–use-keystore] [–keystore-path KEYSTOREPATH]
[–keystore-password KEYSTOREPASSWORD] [–key-alias KEYALIAS]
[–key-password KEYPASSWORD] [–intent-action INTENTACTION]
[–intent-category INTENTCATEGORY] [–intent-flags INTENTFLAGS]
[–intent-args OPTIONALINTENTARGUMENTS] [–dont-stop-app-on-reset]
[–calendar-format CALENDARFORMAT] [–native-instruments-lib]
[–keep-keychains] [–localizable-strings-dir LOCALIZABLESTRINGSDIR]
[–show-ios-log] [–async-trace]

Thanks this was really helpful @mykola-mokhnach .
took a while to understand. Working fine now.

For those who face the same problem:
What you need to do is simple.
set desired capabilities like this when you create driver
along with other capabilities.

so the next problem you will face is same error because its going to use same port for multiple devices…
Every driver needs a unique port between 8200 to 8299
So to do that
add a parameter in testng.xml like this
<parameter name=“systemPort” value=“8201”/>

and pass it to
@BeforeTest(alwaysRun = true)
@Parameters({ “port”, “device”, “platformVersion”, “systemIp”, “systemPort” })

thats all.

I’m done making my changes. Below mentioned repository is having code
which will automatically configure appium nodes, selenium grid and start execution for devices connected to PC.

Those who are trying to configure parallel tests can use.
It will sure save sometime.

Hello @Prajith_KP

Could you please help with the complete code ?

Need to know what is written in Capability class, Testcase file and Testng .

I am doing the same but facing issue with passing the values