Selenium: JSON Node Configuration File

Created on 7 Apr 2017  路  5Comments  路  Source: SeleniumHQ/selenium

Meta -

OS: Windows

Selenium Version: 3.3.1

Browser: Chrome

Browser Version: Latest

Expected Behavior -

Selenium Grid JSON node configuration file should work with Selenium 3

Actual Behavior -

Selenium Grid 2 JSON node configuration file doesn't work with Selenium 3

Steps to reproduce -


Hi,

Could someone please tell me what the difference is between version 2 and version 3 of the JSON node configuration profile?

Version 2:
https://github.com/SeleniumHQ/selenium/blob/selenium-2.53.0/java/server/src/org/openqa/grid/common/defaults/DefaultNode.json

Version 3:
https://github.com/SeleniumHQ/selenium/blob/master/java/server/src/org/openqa/grid/common/defaults/DefaultNodeWebDriver.json

I am trying to upgrade my version 2 profile, but I am not sure what parameters to change / keep.

{
  "capabilities":
  [
<%=
  require 'json'
  capabilities = []

  if @google_chrome
    capabilities.push(JSON.generate({
      :browserName        => 'chrome',
      :version            => 'ga',
      :platform           => 'WINDOWS',
      :maxInstances       => 5,
      :takesScreenshot    => true,
      :seleniumProtocol   =>'WebDriver'
    }))
  end

  capabilities.join(',')
%>

  ],

  "nodeTimeout": 120,
  "host": "<%=@grid_client_host %>",
  "port": <%=@grid_client_port %>,
  "hubPort": 4444,
  "hubHost": "<%=@grid_host %>",
  "nodePolling": 2000,
  "registerCycle": 10000,
  "register": true,
  "cleanUpCycle": 2000,
  "throwOnCapabilityNotPresent": true,
  "timeout": 30000,
  "maxSession": 20

}

Most helpful comment

The differences are intentional and are documented here - https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-the-nodes-by-json

All 5 comments

This is a question rather than an issue. Please send questions to the selenium user group

The differences are intentional and are documented here - https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-the-nodes-by-json

Hi @mach6

The reason I am unsure is because in the 3.x example you have given, you are using parameters which are not listed in the 2.x example. Such as the register or role option.

Ideally, is it possible to list the node options for Selenium Grid 3, like we have for Selenium Grid 2 (as shown below)
https://github.com/SeleniumHQ/selenium/blob/selenium-2.53.0/java/server/src/org/openqa/grid/common/defaults/NodeOptions.json

This would provide clarity and avoid confusion. I鈥檓 working with a piece of 2.x code (as above) (that includes old 2.x parameters such as nodeTimeout) which is being upgraded to use 3.x parameters.

Many thanks.

If you do java -jar selenium-server-standalone.jar -role node -h the config params and their meaning should become more clear.

Usage: <main class> [options]
  Options:
    --version, -version
       Displays the version and exits.
       Default: false
    -browserTimeout
       <Integer> in seconds : number of seconds a browser session is allowed to
       hang while a WebDriver command is running (example: driver.get(url)). If the
       timeout is reached while a WebDriver command is still processing, the session
       will quit. Minimum value is 60. An unspecified, zero, or negative value means
       wait indefinitely.
       Default: 0
    -capabilities, -browser
       <String> : comma separated Capability values. Example: -capabilities
       browserName=firefox,platform=linux -capabilities browserName=chrome,platform=linux
       Default: [Capabilities [{seleniumProtocol=WebDriver, browserName=chrome, maxInstances=5}], Capabilities [{seleniumProtocol=WebDriver, browserName=firefox, maxInstances=5}], Capabilities [{seleniumProtocol=WebDriver, browserName=internet explorer, maxInstances=1}]]
    -cleanUpCycle
       <Integer> in ms : specifies how often the hub will poll running proxies
       for timed-out (i.e. hung) threads. Must also specify "timeout" option
    -custom
       <String> : comma separated key=value pairs for custom grid extensions.
       NOT RECOMMENDED -- may be deprecated in a future revision. Example: -custom
       myParamA=Value1,myParamB=Value2
       Default: {}
    -debug
       <Boolean> : enables LogLevel.FINE.
       Default: false
    -downPollingLimit
       <Integer> : node is marked as "down" if the node hasn't responded after
       the number of checks specified in [downPollingLimit].
       Default: 2
    -host
       <String> IP or hostname : usually determined automatically. Most commonly
       useful in exotic network configurations (e.g. network with VPN)
    -hub
       <String> : the url that will be used to post the registration request.
       This option takes precedence over -hubHost and -hubPort options.
       Default: http://localhost:4444
    -hubHost
       <String> IP or hostname : the host address of the hub we're attempting to
       register with. If -hub is specified the -hubHost is determined from it.
    -hubPort
       <Integer> : the port of the hub we're attempting to register with. If
       -hub is specified the -hubPort is determined from it.
    -id
       <String> : optional unique identifier for the node. Defaults to the url
       of the remoteHost, when not specified.
    -jettyThreads, -jettyMaxThreads
       <Integer> : max number of threads for Jetty. An unspecified, zero, or
       negative value means the Jetty default value (200) will be used.
    -log
       <String> filename : the filename to use for logging. If omitted, will log
       to STDOUT
    -maxSession
       <Integer> max number of tests that can run at the same time on the node,
       irrespective of the browser used
       Default: 5
    -nodeConfig
       <String> filename : JSON configuration file for the node. Overrides
       default values
    -nodePolling
       <Integer> in ms : specifies how often the hub will poll to see if the
       node is still responding.
       Default: 5000
    -nodeStatusCheckTimeout
       <Integer> in ms : connection/socket timeout, used for node "nodePolling"
       check.
       Default: 5000
    -port
       <Integer> : the port number the server will use.
       Default: 5555
    -proxy
       <String> : the class used to represent the node proxy. Default is
       [org.openqa.grid.selenium.proxy.DefaultRemoteProxy].
       Default: org.openqa.grid.selenium.proxy.DefaultRemoteProxy
    -register
       if specified, node will attempt to re-register itself automatically with
       its known grid hub if the hub becomes unavailable.
       Default: true
    -registerCycle
       <Integer> in ms : specifies how often the node will try to register
       itself again. Allows administrator to restart the hub without restarting (or
       risk orphaning) registered nodes. Must be specified with the "-register"
       option.
       Default: 5000
    -role
       <String> options are [hub], [node], or [standalone].
       Default: node
    -servlet, -servlets
       <String> : list of extra servlets the grid (hub or node) will make
       available. Specify multiple on the command line: -servlet tld.company.ServletA
       -servlet tld.company.ServletB. The servlet must exist in the path:
       /grid/admin/ServletA /grid/admin/ServletB
       Default: []
    -timeout, -sessionTimeout
       <Integer> in seconds : Specifies the timeout before the server
       automatically kills a session that hasn't had any activity in the last X seconds. The
       test slot will then be released for another test to use. This is typically
       used to take care of client crashes. For grid hub/node roles, cleanUpCycle
       must also be set.
       Default: 1800
    -unregisterIfStillDownAfter
       <Integer> in ms : if the node remains down for more than
       [unregisterIfStillDownAfter] ms, it will stop attempting to re-register from the hub.
       Default: 60000
    -withoutServlet, -withoutServlets
       <String> : list of default (hub or node) servlets to disable. Advanced
       use cases only. Not all default servlets can be disabled. Specify multiple on
       the command line: -withoutServlet tld.company.ServletA -withoutServlet
       tld.company.ServletB
       Default: []

With the exception of version, each dash option can be mapped to a corresponding _nodeConfig.json_ entry.

That said, not all make sense to specify in a _nodeConfig.json_ -- though you technically can.

Examples that don't make sense to include are role: {value} (the server is already started with -role node for -nodeConfig to be a viable dash option), nodeConfig: {value} (why point one _nodeConfig.json_ to another), and host: {value}, port: {value}, hubHost: {value}, hubPort: {value} (probably shouldn't hard code these).

Does this clarify?

  1. Can a selenium node run without a hub??
  2. If the hub and nodes are distributed then how can I get the info of hub from the node?
  3. What if we give register=false in node json file? How it鈥檒l behave?
Was this page helpful?
0 / 5 - 0 ratings