0
votes

I'm using selenium grid to realize functional testing, i combine it with testNG to run multiple test at the same time. When i run testNG, firefox start execute the selenium script, but the problem is that i can't have more than 5 browser at the same time and i don't know why. Here is the way i start the hub and the node.

The hub :

start java -jar %seleniumPath% -port 4444 -role hub -nodeTimeout 1000

The node :

start java -jar %seleniumPath% -role node -hub http://localhost:4444/grid/register -browser browserName=firefox,maxInstances=1,maxSession=1 -port 5555

The way i understand it, i should be able to have only 1 firefox browser opened at a time. But whatever the number is, the maxInstnaces and maxSession options seems to be ignored and the number of browser simultaneously running remains 5 or less.

This is a screenshot of my grid console which show how much instance this node could handle at the same time. When i put a high number like 100 or 200, i have the corresponding incons. enter image description here

1
are you trying to say, you don't have more than 5 browsers running at a time though you have changed the value of maxSession right? - Paras

1 Answers

1
votes

Generally maxSessions overrides the maxInstances. maxInstances defines how many instances of a particular browser you can spin up on the selenium node.

maxSessions defines how many total sessions including all the browsers we can run on selenium node.

so maxSessions is cumulative property for all the browsers. for example if you have set maxInstances=2 for firefox, maxInstances=2 for chrome, it means at max you can run 2 firefox and 2 chromes at a time, but on the same time if you have configured maxSessions=3 then you can spin up only 3 sessions at a time, which may be 2 FF, 1 Chrome, 1 FF, 2 chrome.

If you run : java -jar selenium-server.jar -role node -h It will show all possible options for node role there you can find : -maxSession: max number of tests that can run at the same time on the node, independently of the browser used.

At last, if maxSessions < [maxInstances for all the browsers], maxSessions will be given priority And thats why if you set maxInstances to even 100, 200 but keep maxSessions to 1 it will show only 1 in the console