Connecting appium server to selenium grid for android

@bhaskar I am also facing the same issue.

is your issue resolved if yes then please guide me how to resolve this issue

@Hassan_Radi
@Arvind_Patel

I am able to run my tests in parallel on three devices but I see failures due to Explicit and Implicit wait not working on Grid, any solution for that??

Hello all,
Driver creation always failed for me when I try to run a test

I’m using Ruby Appium_lib 9.4.2, Selenium server 3.4.0 and Appium 1.6.4

Here is the error code I got
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/response.rb:72:inassert_ok’: status code 500 (Selenium::WebDriver::Error::ServerError)`

Here is the test script

require 'appium_lib'

desired_caps = {
  caps:       {
platformName: 'Android',
deviceName: 'Galaxy A5 (2017)',
appPackage: 'com.samsung.android.messaging',
appActivity: 'com.android.mms.ui.ConversationComposer'
  },
  appium_lib: {
server_url: 'http://192.168.43.78:4444/wd/hub'
  }
}

driver = Appium::Driver.new(desired_caps)
driver.start_driver()
driver.find_element(:xpath, "some_button_xpath").click();
driver.driver_quit

The command I use to for Grid
java -jar selenium-server-standalone-3.4.0.jar -role hub

The appium json config file

`{
"capabilities": [{
    "browserName": "Galaxy A5 (2017)",
    "version": "6.0.1",
    "platform": "Android",
    "maxInstances": 1
}],
"configuration": {
    "cleanUpCycle": 2000,
    "timeout": 30000,
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "url": "http://127.0.0.1:5000/wd/hub",
    "host": "127.0.0.1",
    "port": 5000,
    "maxSession": 1,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4444,
    "hubHost": "127.0.0.1"
}

}`

and the log from appium server

`[Appium] Welcome to Appium v1.6.4

[Appium] Non-default server args:
[Appium] port: 5000
[Appium] nodeconfig: C:\md\appium\grid_test1.json
[debug] [Appium] Starting auto register thread for grid. Will try to register every 5000 ms.
[Appium] Appium REST http interface listener started on 0.0.0.0:5000
[debug] [Appium] Appium successfully registered with the grid on 127.0.0.1:4444
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.6.4”,“revision”:null}}
[HTTP] <-- GET /wd/hub/status 200 27 ms - 83
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.6.4”,“revision”:null}}
[HTTP] <-- GET /wd/hub/status 200 21 ms - 83
[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“browserName”:"",“version”:"",“platform”:“ANY”,“javascriptEnabled”:true,“cssSelectorsEnabled”:true,“takesScreenshot”:true,“nativeEvents”:false,“rotatable”:false,“platformName”:“Android”,“deviceName”:“Galaxy A5 (2017)”,“appPackage”:“com.samsung.android.messaging”,“appActivity”:“com.android.mms.ui.ConversationComposer”}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“browserName”:"",“version”:"",“platform”:“ANY”,“javascriptEnabled”:true,“cssSelectorsEnabled”:true,“takesScreenshot”:true,“nativeEvents”:false,“rotatable”:false,“platformName”:“Android”,“deviceName”:“Galaxy A5 (2017)”,“appPackage”:“com.samsung.android.messaging”,“appActivity”:“com.android.mms.ui.ConversationComposer”},null,null,null,null]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1495144179274 (17:49:39 GMT-0400 (Eastern Daylight Time))
[Appium] Creating new AndroidDriver (v1.17.1) session
[Appium] Capabilities:
[Appium] browserName: ‘’
[Appium] version: ‘’
[Appium] platform: ‘ANY’
[Appium] javascriptEnabled: true
[Appium] cssSelectorsEnabled: true
[Appium] takesScreenshot: true
[Appium] nativeEvents: false
[Appium] rotatable: false
[Appium] platformName: ‘Android’
[Appium] deviceName: ‘Galaxy A5 (2017)’
[Appium] appPackage: ‘com.samsung.android.messaging’
[Appium] appActivity: ‘com.android.mms.ui.ConversationComposer’
[debug] [AndroidDriver] AndroidDriver version: 1.17.1
[BaseDriver] The following capabilities were provided, but are not recognized by appium: version, platform, javascriptEnabled, cssSelectorsEnabled, takesScreenshot, nativeEvents, rotatable.
[BaseDriver] Session created with session id: 17360c17-b294-42b6-b2e4-5a593d0a5c09
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_131
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[AndroidDriver] Using device: 521019605e45b30f
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe
[debug] [ADB] Setting device id to 521019605e45b30f
[AndroidDriver] App file was not listed, instead we’re going to run com.samsung.android.messaging directly on the device
[debug] [AndroidDriver] Checking whether package is present on the device
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“pm”,“list”,“packages”,“com.samsung.android.messaging”]
[AndroidDriver] Starting Android session
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“wait-for-device”]
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“echo”,“ping”]
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing settings apk to device…
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“pm”,“list”,“packages”,“io.appium.settings”]
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for io.appium.settings
[debug] [ADB] Getting connected devices…
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Users\test\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“dumpsys”,“package”,“io.appium.settings”]
[ADB] Cannot read version codes of C:\Users\test\AppData\Roaming\npm\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk and/or io.appium.settings. Assuming correct app version is already installed
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“getprop”,“ro.build.version.sdk”]
[debug] [ADB] Device API level: 23
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“dumpsys”,“package”,“io.appium.settings”]
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“pm”,“dump”,“io.appium.settings”]
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“pm”,“grant”,“io.appium.settings”,“android.permission.INTERNET”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.CHANGE_NETWORK_STATE”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_NETWORK_STATE”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.READ_PHONE_STATE”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.WRITE_SETTINGS”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.CHANGE_WIFI_STATE”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_WIFI_STATE”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_FINE_LOCATION”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_COARSE_LOCATION”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_MOCK_LOCATION”,";"]
[HTTP] <-- GET /wd/hub/status - - ms - -
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [AndroidDriver] Pushing unlock helper app to device…
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“install”,“C:\Users\test\AppData\Roaming\npm\node_modules\appium\node_modules\appium-unlock\bin\unlock_apk-debug.apk”]
[debug] [ADB] Device API level: 23
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“appops”,“set”,“io.appium.settings”,“android:mock_location”,“allow”]
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“getprop”,“ro.build.version.release”]
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“wm”,“size”]
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“getprop”,“ro.product.model”]
[debug] [ADB] Current device property ‘ro.product.model’: SM-A520W
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“getprop”,“ro.product.manufacturer”]
[debug] [ADB] Current device property ‘ro.product.manufacturer’: samsung
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [AndroidDriver] No app capability. Assuming it is already on the device
[debug] [AndroidDriver] Running fast reset (stop and clear)
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“am”,“force-stop”,“com.samsung.android.messaging”]
[HTTP] <-- GET /wd/hub/status - - ms - -
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“pm”,“clear”,“com.samsung.android.messaging”]
[debug] [AndroidBootstrap] Watching for bootstrap disconnect
[debug] [ADB] Forwarding system: 4724 to device: 4724
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“forward”,“tcp:4724”,“tcp:4724”]
[debug] [UiAutomator] Starting UiAutomator
[debug] [UiAutomator] Moving to state ‘starting’
[debug] [UiAutomator] Parsing uiautomator jar
[debug] [UiAutomator] Found jar name: ‘AppiumBootstrap.jar’
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“push”,“C:\Users\test\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-bootstrap\bootstrap\bin\AppiumBootstrap.jar”,"/data/local/tmp/"]
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“ps”]
[ADB] No uiautomator process found to kill, continuing…
[debug] [UiAutomator] Starting UIAutomator
[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“uiautomator”,“runtest”,“AppiumBootstrap.jar”,"-c",“io.appium.android.bootstrap.Bootstrap”,"-e",“pkg”,“com.samsung.android.messaging”,"-e",“disableAndroidWatchers”,false,"-e",“acceptSslCerts”,false]
[debug] [UiAutomator] Moving to state ‘online’
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Loading json…
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] json loading complete.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
[AndroidBootstrap] Android bootstrap socket is now connected
[debug] [ADB] Getting connected devices…
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“dumpsys”,“window”]
[AndroidDriver] Screen already unlocked, doing nothing
[debug] [ADB] Device API level: 23
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\test\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args: ["-P",5037,"-s",“521019605e45b30f”,“shell”,“am”,“start”,"-W","-n",“com.samsung.android.messaging/com.android.mms.ui.ConversationComposer”,"-S","-a",“android.intent.action.MAIN”,"-c",“android.intent.category.LAUNCHER”,"-f",“0x10200000”]
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[Appium] New AndroidDriver session created successfully, session 17360c17-b294-42b6-b2e4-5a593d0a5c09 added to master session list
[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1495144201498 (17:50:01 GMT-0400 (Eastern Daylight Time))
[debug] [MJSONWP] Responding to client with driver.createSession() result: {“platform”:“ANY”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“browserName”:"",“version”:"",“platform”:“ANY”,“javascriptEnabled”:true,“cssSelectorsEnabled”:true,“takesScreenshot”:true,“nativeEvents”:false,“rotatable”:false,“platformName”:“Android”,“deviceName”:“Galaxy A5 (2017)”,“appPackage”:“com.samsung.android.messaging”,“appActivity”:“com.android.mms.ui.ConversationComposer”},“browserName”:"",“version”:"",“cssSelectorsEnabled”:true,“nativeEvents”:false,“rotatable”:false,“platformName”:“Android”,“deviceName”:“521019605e45b30f”,“appPackage”:“com.samsung.android.messaging”,“appActivity”:“com.android.mms.ui.ConversationComposer”,“deviceUDID”:“521019605e45b30f”,“platformVersion”:“6.0.1”,“deviceScreenSize”:“1080x1920”,“deviceModel”:“SM-A520W”,“deviceManufacturer”:“samsung”}
[HTTP] <-- POST /wd/hub/session 200 22223 ms - 995
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.6.4”,“revision”:null}}
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.6.4”,“revision”:null}}
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.6.4”,“revision”:null}}
[HTTP] <-- GET /wd/hub/status 200 648 ms - 83
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.6.4”,“revision”:null}}
[HTTP] <-- GET /wd/hub/status 200 22 ms - 83
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.6.4”,“revision”:null}}
[HTTP] <-- GET /wd/hub/status 200 22 ms - 83
[HTTP] --> GET /wd/hub/status {}`

plz share the @BeforeTest part

How did u resolve ur problem… plz let me know.

see this video https://youtu.be/vXpskMkytD8

Hi @rgonalo,

How would i get device name & UDID for android emulator, can u plz provide an example.

Hi @Manish093, to get the serial number of each connected Android device or emulator execute:

$ adb devices

List of devices attached
emulator-5554 device

In this case, emulator-5554 is the emulator serial number.

What does that /wb/hub in the end of server url will do?

Hi gays,
Using the selenium grid is a bad way to do the parrel test.
You should check http://appium.io/docs/en/writing-running-appium/caps/ carefully and know which cap can support this. Also, Appium server is already a service to handle all requests to do the actions. So please think more about the code

https://appium.io/docs/en/writing-running-appium/caps/ this link in above message throws 404 Error