0

I using the following to register my node (same machine as the Hub):

java -Dwebdriver.chrome.driver = <chromedriver_path> -jar selenium-server-standalone-3.9.1.1.jar -role node -hub "https://localhost:4444/grid/register/" -browser "browserName=chrome,maxInstances=10"

But, when I execute the test cases only 4 browsers are launched. Is there a setting that I am missing or using some default setting unknowingly? Please help.

1 Answers1

0

Yes, there are 2 configuration params in Selenium 3 related to your issue:

  • maxInstances: how many instances for the same type you can run on your node;
  • maxSession: how many sessions for all types you can run on your node.

For example, in case you want to run tests for Chrome and IE:

maxSession = 10 it means that on your node only 10 sessions from both Chrome and IE can run. Then, you can define how many to run of each type, in the specific browser settings command:

-browser "browserName=chrome,maxInstances=6"

-browser "browserName=IE,maxInstances=4"

Hence, the maxSession is the total number of all instances. By default, I belive is 5, but you can change it by adding this to your command:

SOLUTION: java -Dwebdriver.chrome.driver = <chromedriver_path> -jar selenium-server-standalone-3.9.1.1.jar -role node -hub "https://localhost:4444/grid/register/" -browser "browserName=chrome,maxInstances=10" –maxSession 10

Sources:

https://www.softwaretestinghelp.com/selenium-grid-selenium-tutorial-29/#maxSession

Selenium Grid: MaxSessions vs MaxInstances

For SELENIUM 4, it's a bit different as you need 2 parameters:

  • one to override the default max sessions setting: --override-max-sessions true
  • one to establish the number of sessions that you want: --max-sessions 20

Command example: java -jar selenium-server-4.0.0-rc-3.jar node --detect-drivers true --max-sessions 20 --override-max-sessions true

Sources: https://testingbootcamp.com/parallel-testing-with-selenium-grid-and-integration-with-jenkins-9d959dddbc1c https://www.selenium.dev/documentation/grid/configuration/toml_options/ https://webelement.click/en/selenium_grid_4_complete_guide_to_configuration_flags#_override_max_sessions

AdinaT
  • 1
  • Thanks Adina. I had already tried these options, but failed to launch more than 4 browser instances at a time. However, I did find out that my VM has only 4 virtual processors and this is probably the reason for achieving only as many instances. Still not 100% sure that this is the actual cause, but this is the only thing that is making sense to me for now. – Rushikesh Khopatkar May 05 '22 at 04:06