Selenium Grid Configuration

Posted 悟空救我呀

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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_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

 

以上是关于Selenium Grid Configuration的主要内容,如果未能解决你的问题,请参考以下文章

如何使用Selenium-Grid

测试人员如何搭建Selenium-Grid2环境(参考Java)

如何使用Selenium-Grid

Selenium-Grid:如何使用`user-extensions.js`

selenium Grid

Selenium Grid Configuration