Skip to content

Mobile Selenium Grid

NikolayStanoev edited this page Feb 27, 2017 · 2 revisions

This page contains information how to run appium as part of Selenium Grid.

Why Selenium Grid

Running appium as part of Selenium Grid gives you a lot of power:

  • Running tests against a single URL address
  • Almost 0 degradation in terms of execution time
  • Executing tests in parallel

If you run appium as a server it is still possible to achieve the points above but it will be a bit difficult.

Prerequisite

  • Setup appium in order to run tests against mobile emulators / simulators

Prepare nodeconfig.json

You need to create a nodeconfig.json file which will describe what kind of tests can be executed against current node.

  • Example for Chrome / Android Default Browser / Safari
   {
  "capabilities": [
        {
          "browserName": "Chrome",
          "version":"6.0",
          "maxInstances": 1,
          "platform":"ANDROID"
	},
        {
          "browserName": "Browser",
          "version":"6.0",
          "maxInstances": 1,
          "platform":"ANDROID"
	},
        {
          "browserName": "safari",
          "version":"10.2",
          "maxInstances": 1,
          "platform":"MAC"
	}
     ],
  "configuration":
  {
    "cleanUpCycle": 2000,
    "timeout": 30000,
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "url": "http://<appium_ip_address>:<appium_port>/wd/hub",
    "maxSession": 1,
    "register": true,
    "registerCycle": 5000,
    "nodeStatusCheckTimeout": 30000,
    "hubPort": <grid_port>,
    "hubHost": "<grid_ip_address>",
    "role": "node"
  }
}

The example above shows Chrome / default android browser / safari in a single nodeconfig.json file. If you have a MAC machine with enough memory you should not have any problems to run both Android Emulator and iOS Simulators from single machine via single appium server. If this is the case then you should edit maxSession to 2.

Starting appium as part of Selenium Grid

Below you can find an example how to run appium as part of Selenium Grid. For this example we will consider the following:

  • IP address of appium machine is 172.24.64.211
  • Port on which appium server is going to listen is 4723
  • IP address of Selenium Grid is 172.24.64.226
appium --nodeconfig ./nodeconfig-appium.json -a 172.24.64.211 -p 4723 -ca 172.24.64.211 -cp 4723

Appium comes out of the box with integrated chromedriver executable. In appium 1.6.3 it is version 2.25. If you want to run tests using different chromedriver version (for example against native chrome browser which is version 44) you need to start the server with different chromedriver executable. This can be done via

appium --nodeconfig ./nodeconfig-appium.json -a 172.24.64.211 -p 4723 -ca 172.24.64.211 -cp 4723 --chromedriver-executable ./chrome220.exe