Selenium grid configuration
Author: Max. Bai
Time: 2014/06
1. Start selenium Hub
java -jar selenium-server-standalone-2.<last_version>.jar-role hub
Can be check the hub status Use http: // 127.0.0.1: 4444/GRID/console
2. Start selenium Node
Start with node contains selenium RC and WebDriver
java -jar selenium-server-standalone-2.29.0.jar -role node -hub http://localhost:4444/grid/register
Start with WebDriver contains WebDriver
java -jar selenium-server-standalone-2.29.0.jar -role webdriver -hub http://localhost:4444/grid/register
Start with selenium contains selenium RC
java -jar selenium-server-standalone-2.29.0.jar -role selenium -hub http://localhost:4444/grid/register
3. Start hub and node with JSON config
Start hub with JSON Config File
title HubWebDriverjava -jar selenium-server-standalone-2.29.0.jar-role hub-hubConfig hubconfig.jsonpause
Hubconfig. JSON
{ "host": null, "port": 4444, "newSessionWaitTimeout": 300000, "servlets" : [], "prioritizer": null, "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "throwOnCapabilityNotPresent": true, "nodePolling": 5000, "cleanUpCycle": 5000, "nodeTimeout": 360000, "timeout": 480000, "browserTimeout": 0, "maxSession": 5}
Start node with JSON File
title NodeWebDriverjava -jar selenium-server-standalone-2.<last_version>.jar-Dwebdriver.ie.driver="ABSOLUTE_PATH\IEDriverServer.exe"-Dwebdriver.chrome.driver="ABSOLUTE_PATH\chromedriver.exe"-Dwebdriver.safari.bin="ABSOLUTE_PATH\Safari.exe"-Dwebdriver.opera.bin="ABSOLUTE_PATH\opera.exe"-Dwebdriver.chrome.bin="ABSOLUTE_PATH\chrome.exe"-Dwebdriver.ie.bin="ABSOLUTE_PATH\iexplore.exe"-role node-nodeConfig nodeconfig.jsonpause
Nodeconfig. JSON
{ "capabilities": [{"seleniumProtocol": "Selenium","platform": "MAC","browserName": "*iexplore","maxInstances": "1"},{"seleniumProtocol": "Selenium","platform": "MAC","browserName": "*firefox","maxInstances": "5","firefox_binary":"c:\sss\firefox.exe"}, { "seleniumProtocol":"Selenium", "browserName":"*firefox", "maxInstances":1 }, { "seleniumProtocol":"WebDriver", "browserName":"firefox", "maxInstances":1, "firefox_binary":"c:\sss\firefox.exe" }, { "seleniumProtocol":"WebDriver", "browserName":"internet explorer", "maxInstances":1 }, { "seleniumProtocol":"WebDriver", "browserName":"chrome", "maxInstances":1 "chrome_binary":"c:\sss\chrome.exe" }, { "seleniumProtocol":"WebDriver", "browserName":"opera", "maxInstances":1 }, { "seleniumProtocol":"WebDriver", "browserName":"safari", "maxInstances":1 } ], "configuration": { "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "maxSession": 5, "port": 5531, "hubHost": "IP Address of the Hub", "register": true, "registerCycle": 5000, "hubPort": 4444 }}
Other settings for-Browser
- -Browser <Params> If-browser is not set, a node will start with 5 Firefox, 1 chrome, and 1 Internet Explorer instance (assuming it's on a Windows box ). this parameter can be set multiple times on the same line to define multiple types of browsers.
Parameters allowed for-Browser: browsername = {Android, chrome, Firefox, htmlunit, Internet Explorer, iPhone, opera} version = {browser version} firefox_binary = {path to executable binary} chrome_binary = {path to executable binary} maxinstances = {maximum number of browsers of this type} platform = {windows, linux, Mac}
Relate page:
Https://code.google.com/p/selenium/wiki/Grid2
Https://code.google.com/p/selenium/source/browse/java/server/src/org/openqa/grid/common/defaults/DefaultNode.json
Https://code.google.com/p/selenium/source/browse/java/server/src/org/openqa/grid/common/defaults/DefaultHub.json