Skip to content

Working with the Selenium Grid

Yosef Durr edited this page Mar 18, 2019 · 1 revision

Using Windows devices with the Selenium Grid

Below is an example on how to enable registering Windows devices with Appium and the Selenium Grid. Additional info is provided on the Appium documentation

Setup a Windows test machine as a test Node

  1. Install Java Development Kit
  2. Add to the Environment Variables JAVA_HOME and set it to the base path of your installation, for example "C:\Program Files\Java\jdk1.8.0_121"
  3. Add to the Path environment variable the folder where "Jar.exe" is located, for example, you'd add "C:\Program Files\Java\jdk1.8.0_121\bin" to the path
  4. Download latest node and npm tools MSI (version >= 6.0) and install it.
  5. Verify that the npm and nodejs paths are in your PATH environment variable. If not, add them manually to the PATH, should be: %APPDATA%\npm;C:\Program Files\nodejs\
  6. Open a Command Prompt in Administrative mode
  7. Run the command "npm install appium" This will install Appium from NPM

Connecting to a Selenium Grid

Run the Selenium Hub

  1. Download latest Selenium Jar
  2. Launch a command line
  3. Run "java -jar selenium-server-standalone-3.0.1.jar -role hub -port 4444"

Node machine setup

  1. Edit a JSon configuration file for Appium to let Appium know where the Selenium grid is located. See here for more information. Look at the rows in bold, those indicate where the Selenium hub is located. The JSon looks something like this
	{
	  "capabilities":
	      [
	        {
	          "browserName": "",
	          "version":"",
	          "maxInstances": 3,
	          "platform":"WINDOWS"
	        }
	      ],
	  "configuration":
	  {
		"cleanUpCycle":2000, 
		"timeout":30000, 
		"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
		"url":"http://127.0.0.1:4723/wd/hub",
		"host":"127.0.0.1",
		"port":4723, 
		"maxSession":3,
		"register":true,
		"registerCycle":10000,
		**"hub": "127.0.0.1:4444/grid/register",
		"hubPort":4444,
		"hubHost":"127.0.0.1",**
		"nodeTimeout":120, 
		"nodePolling":2000
	  }
	}
  1. Launch a Command line
  2. Run this, assuming AppiumNode.json is the config file you created node appium --nodeconfig AppiumNode.json -p 4723