Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Grid: MaxSessions vs MaxInstances

I was wondering if anybody could shed some light on a Selenium question that has been giving us a bit of head scratching.

We're confused on meaning of MaxSession and MaxInstances of Selenium Grid. We think that the MaxSession is the total number of test sessions that can run on a single node. And we also think that the MaxInstances is the total number of browsers that a test can open.

Or is MaxInstances the total number of browsers available to the node?

The command that we are using is:

java -Xrs -jar selenium-server.jar -role node -port 44506 -hub http://localhost:44500 /grid/register -firefoxProfileTemplate SeleniumProfile -timeout 300000 -browser  "browserName=firefox,maxInstances=10,platform=ANY,seleniumProtocol=WebDriver" -browser  "browserName=chrome,maxInstances=10,platform=ANY,seleniumProtocol=WebDriver" 

We think the way we are using our node (above) is 5 concurrent test sessions by default.

Does each test have 20 browsers available to it?

Or does each test session share the 20 browsers (10 chrome/10 FF) in a pool - with the other test sessions?

like image 508
Christian Clarke Avatar asked Dec 05 '12 12:12

Christian Clarke


People also ask

How do I limit the number of browser Initializations in selenium node?

The command to do that is as follows: java -jar selenium-server-standalone-3.12. 0. jar -role node -hub http://192.168.0.1:1111/grid/register -browser "browserName=firefox,max Instances=3" -browser "browserName=chrome,maxInstances=3" -browser "browserName=safari,maxInstances=1" ...

Is selenium Grid still used?

Selenium Grid can be used to perform Cross Browser Testing at a scale, by running a test on different browser-device combinations simultaneously. Using parallel testing, you can ensure a consistent user experience across various browser versions and devices in a short period of time.

Can we configure selenium grid using JSON file?

Selenium has an in built JSON config file that can be used to set up selenium grid. Below are the steps to configure selenium grid using JSON config file. NOTE: The URL may vary from machine to machine. URL followed by 'Nodes should register to' on the above screen must be used.

What is the difference between selenium WebDriver and selenium grid?

Unlike Selenium WebDriver which allows you automated browser testing in a sequential manner, a Selenium Grid setup will allow you to run test cases in different browsers/ browser versions, simultaneously. One of the reasons behind the huge popularity of Selenium is its capability to automate cross browser testing.


1 Answers

Nice question....i would say it's bit confusing.... But will try to answer it in simple terms..

MaxInstances This says....how many instances of same version of browser can run over the Remote System.

For example, i have a FF12,IE and i declared the command as follows -browser browserName=firefox,version=12,maxInstances=5,platform=LINUX -browser browserName=InternetExplorer,version=9.0,maxInstances=5,platform=LINUX 

So i can run 5 instances of Firefox 12 and as well as 5 instances of IE9 at the same time in remote machine. So total user can run 10 instances of different browsers (FF12 & IE9) in parallel.

MaxSession This says....how many browsers (Any Browser and any version) can run in parallel at a time in the remote system. So this overrides the Max Instances settings and can restrict the number of browser instances that can run in parallel.

For above example, when maxSession=1 forces that you never have more than 1 browser running.   With maxSession=2 you can have 2 Firefox tests at the same time, or 1 Internet Explorer and 1 Firefox test).  

Irrespective of what MaxInstances you have defined.

For more clear info do visit - https://seleniumhq.github.io/docs/grid.html

like image 140
Anuragh27crony Avatar answered Sep 17 '22 14:09

Anuragh27crony