Sunday, January 17, 2016

Selenium GRID JSON for HUB and NODE


Setting the GRID node and hub capability with JSON


java -jar selenium-server-standalone.jar -role node -nodeConfig nodeconfig.json

NODE.json

{
  "capabilities":
      [
        {
          "browserName": "*firefox",
          "maxInstances": 5,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "*googlechrome",
          "maxInstances": 5,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "*iexplore",
          "maxInstances": 1,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "firefox",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
        {
          "browserName": "chrome",
          "browserVersion": 47.0.2526.111,
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
        {
          "browserName": "internet explorer",
          "maxInstances": 1,
          "seleniumProtocol": "WebDriver"
        }
      ],
  "configuration":
  {
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "maxSession": 5,
    "port": 5555,
    "host": 192.168.0.101,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4447,
    "hubHost": 192.168.0.100
  }
}


java -jar selenium-server-standalone.jar -role hub -hubConfig hubconfig.json

HUB.json

{
  "host": 192.168.0.100,
  "port": 4447,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,

  "cleanUpCycle": 5000,
  "timeout": 300000,
  "browserTimeout": 0,
  "maxSession": 5,
  "jettyMaxThreads":-1
}

2 comments:

  1. For starting the server in HUB mode :-
    java -jar selenium-server-standalone-2.33.0.jar -role hub –port 1111

    For starting the server in NODE mode :-
    java -jar selenium-server-standalone-2.33.0.jar -role node -hub http://:1111/grid/register

    ReplyDelete
  2. RemoteWebDriver constructor signature

    remoteWD = new RemoteWebDriver(new URL("http://:4444/wd/hub"),capabilities);

    this is how it should be used in case of remote web driver and GRID environment

    ReplyDelete