Selenium Grid Configuration

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_PATHIEDriverServer.exe"
-Dwebdriver.chrome.driver="ABSOLUTE_PATHchromedriver.exe"
-Dwebdriver.safari.bin="ABSOLUTE_PATHSafari.exe"
-Dwebdriver.opera.bin="ABSOLUTE_PATHopera.exe"
-Dwebdriver.chrome.bin="ABSOLUTE_PATHchrome.exe"
-Dwebdriver.ie.bin="ABSOLUTE_PATHiexplore.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:sssfirefox.exe"
        },
      {
         "seleniumProtocol":"Selenium",
         "browserName":"*firefox",
         "maxInstances":1
      },
      {
         "seleniumProtocol":"WebDriver",
         "browserName":"firefox",
         "maxInstances":1,
         "firefox_binary":"c:sssfirefox.exe"
      },
      {
         "seleniumProtocol":"WebDriver",
         "browserName":"internet explorer",
         "maxInstances":1
      },
      {
         "seleniumProtocol":"WebDriver",
         "browserName":"chrome",
         "maxInstances":1
         "chrome_binary":"c:ssschrome.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

原文地址:https://www.cnblogs.com/lgm1999/p/5260230.html