We mentioned the first two startup modes of selenium-server. Now let's look at the remaining two startup modes.
3. Start as a hub
java -jar selenium-server-standalone.jar -role hub
Parameter description:
-Role: hub
Start a Hub service and wait for the WebDriver client to register and request it. The default start port is 4444. The default address for receiving registration is http: // localhost: 4444/GRID/register.
-Hubconfig: [filename]
A hub configuration file in JSON format that complies with selenium grid2 rules. For example, [This is the default configuration file used by selenium-grid]
{ "host": null, "port": 4444, "newSessionWaitTimeout": -1, "servlets" : [], "prioritizer": null, "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "throwOnCapabilityNotPresent": true, "nodePolling": 5000, "cleanUpCycle": 5000, "timeout": 300000, "browserTimeout": 0, "maxSession": 5}
-Throwoncapabilitynotpresent: [true | false]
The default value is true. If the value is true, the hub accepts the test request only when the test agent is registered; if the value is false, if no proxy is registered, the request is also accepted and saved to the queue until a proxy is registered.
-Capabilitymatcher: XXX
A class that implements the capabilitymatcher interface. It points to org by default. openqa. grid. internal. utils. defaultcapabilitymatcher; this class is used to implement the matching rules used by the grid to distribute test tasks to the corresponding agent. If you want to test the allocation rules more accurately, register a matching class defined by yourself.
-Prioritizer: xxxclass
A class that implements the prioritizer interface. Set the priority logic for grid to execute the test task. The default value is null. First, run the test task first.
-Port: XXX
Port of the hub listener
-Host: ip_or_host
IP address or host value of the hub
-Newsessionwaittimeout: XXX
The default value is-1, indicating that there is no timeout. It specifies the interval at which a new test session is waiting for execution. That is, the interval between two tests on a proxy node, in milliseconds.
-Servlets: xxxserlet
Register a new serlet on the hub. The access address is/GRID/admin/xxxserlet.
-Browsertimeout:
Timeout for no browser response
-Grid1yml:
A yml file that complies with the grid1 rules, applicable only to grid1
4. Start WebDriver or node
java -jar selenium-server-standalone.jar -role wd -hub http://localhost:4444/grid/registerjava -jar selenium-server-standalone.jar -role rc -hub http://localhost:4444/grid/registerjava -jar selenium-server-standalone.jar -role node -hub http://localhost:4444/grid/register
Parameter description:
-Role: [node | WD | RC]
If the node value is set, the registered RC can support selenium1 and selenium2 test requests;
If the value is WD, it indicates that the registered RC only supports selenium2 WebDriver test requests;
If the RC value is set to RC, the registered RC only supports selenium1 test requests.
-Hub: url_to_hub
The url_to_hub value is the registration address of the hub startup. The default value is ttp: // ip_for_hub: 4444/GRID/register. The specific value is based on the parameter when you start the hub.
This option contains two options:-hubhost and-hubport.
-Hubhost: ip_or_host
IP address or host value of the hub
-Host: ip_or_host
Same as-hubhost
-Hubport: XXX
Listener port of the hub
-Port: XXX
Same as-hubport
-Registercycle: XXX
The period in milliseconds when the proxy node is automatically re-registered. It is suitable for restarting the Hub without restarting all the proxy nodes.
-Nodepolling: XXX
Cycle of the hub check proxy Node
-Unregisterifstilldownafter: XXX
The Unit is milliseconds. It determines how long the hub will cancel the registration information of the proxy node after no response is received by the proxy node. The default value is 1 minute.
-Nodetimeout: XXX
Client's no-Heartbeat timeout
-Maxsession: xx
Maximum number of browsers that a proxy node can start at the same time, that is, the number of sessions
-Cleanupcycle: XXX
Proxy node check timeout period
-Nodeconfig: json_file
A node configuration file in JSON format that complies with selenium grid2 rules. Example:
{ "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", "maxInstances": 5, "seleniumProtocol": "WebDriver" }, { "browserName": "internet explorer", "maxInstances": 1, "seleniumProtocol": "WebDriver" } ], "configuration": { "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "maxSession": 5, "port": 5555, "host": ip, "register": true, "registerCycle": 5000, "hubPort": 4444, "hubHost": ip }}
-Servlets: xxxserlet
Register a new serlet on node. The access address is/GRID/admin/xxxserlet.
-Proxy: proxy class
By default, it points to org. openqa. Grid. Selenium. Proxy. defaultremoteproxy.
-Browsertimeout:
Timeout for no browser response
-Browser: browsername = Firefox, version = 3.6, platform = Linux
Set the registration information of the proxy node, which can also be set in the configuration file. This parameter can be used multiple times to register information of multiple browsers at the same time.
You can set the following information:
browserName=firefoxversion=3.6platform=LINUXmaxInstances=5firefox_binary=/home/myhomedir/firefox36/firefoxchrome_binary="C:\program file\chrome\chrome.exe"
Note:
In addition to the options listed above, you can also append the options supported when an independent RC is started, in addition to communication with the hub, it also includes all functions of the independent RC Server.