Selenium Grid Configuration

时间:2022-07-22 23:02:41

Start Hub and Node with Json config

1. Start Hub with json config file

title HubWebDriver
java -jar selenium-server-standalone-2.29.0.jar
-role hub
-hubConfig hubconfig.json
pause

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
}

2. Start Node with json file

title NodeWebDriver
java -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.json
pause

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
}
}

How to view hub status?

http://192.168.9.106:5531/wd/hub/static/resource/hub.html

How to view node status?

http://192.168.9.63:4444/grid/console