標籤:seleniu grid webdriver grid configuration nodeconfig
Selenium Grid Configuration
作者: Max.Bai
時間: 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