As per the documentation in Configuring the nodes by default, starting a Selenium Grid Node allows for concurrent usage of 11 browsers:
- 5 Firefox
- 5 Chrome
- 1 Internet Explorer
The maximum number of concurrent tests is set to 5 by default. To change this and other browser settings, you can pass in parameters to each -browser
switch (each switch represents a node based on your parameters). If you use the -browser
parameter, the default browsers will be ignored and only what you specify command line will be used.
maxInstances
maxInstances is an optional parameter which can be passed through the -browser
optional parameter.
Usecase 1
To configure a Selenium Grid Node for 20 instances of Firefox version=X.Y.Z you can use the following solution:
Command:
java -Dwebdriver.gecko.driver=geckodriver.exe -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.1.125:4444/grid/register -browser browserName=firefox,version=X.Y.Z,maxInstances=20,platform=WINDOWS
Node Console Logs:
C:\Utility\SeleniumGrid>java -Dwebdriver.gecko.driver=geckodriver.exe -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.1.125:4444/grid/register -browser browserName=firefox,version=X.Y.Z,maxInstances=20,platform=WINDOWS
16:54:11.843 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
16:54:12.003 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 6318
2020-02-14 16:54:12.523:INFO::main: Logging initialized @1022ms to org.seleniumhq.jetty9.util.log.StdErrLog
16:54:12.860 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
16:54:12.974 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 6318
16:54:12.974 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid nodeis up and ready to register to the hub
16:54:13.161 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
16:54:13.765 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://192.168.1.125:4444/grid/register
16:54:13.962 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
Grid Console Snapshot:
Usecase 2
To configure a Selenium Grid Node for 10 instances of Firefox version=A.B.C and 20 instances of Chrome version=X.Y.Z you can use the following solution:
Command:
java -Dwebdriver.gecko.driver=geckodriver.exe -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.1.125:4444/grid/register -browser browserName=firefox,version=X.Y.Z,maxInstances=10,platform=WINDOWS -browser browserName=chrome,version=X.Y.Z,maxInstances=20,platform=WINDOWS
Grid Console Snapshot:
-maxSession
-maxSession is also an optional parameter which can be passed as a main parameter to configure the maximum number of browsing contexts that can run in parallel on a particular node. This is different from the maxInstance
of supported browsers (Example: For a node that supporting Firefox version A.B.C, Firefox version P.Q.R and Chrome version X.Y.Z, maxSession=1 will ensure that you never have more than 1 browser running. With maxSession=2
you can have 2 Firefox tests executing at the same time, or 1 Firefox and 1 Chrome test).
Example:
java -Dwebdriver.gecko.driver=geckodriver.exe -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.1.125:4444/grid/register -browser "browserName=firefox,version=A.B.C,maxInstances=10,platform=WINDOWS" -browser "browserName=firefox,version=P.Q.R,maxInstances=10,platform=WINDOWS" -browser "browserName=chrome,version=X.Y.Z,maxInstances=20,platform=WINDOWS" -maxSession 2