Selenium Grid: MaxSessions vs MaxInstances

北战南征 提交于 2019-11-27 11:00:49

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

MaxInstances: this gives you more slots per node, For example, MaxInstances=5 will allow a maximum of 5 browsers per node

MaxSession: sets the maximum amount of tests that can run at the same time in a node. if MaxInstances=5, then MaxSession should also be at least 5.

see more at https://github.com/SeleniumHQ/docker-selenium

To expand upon Anuragh27crony's answer, I've drawn up a quick diagram:

If this is your node config, then you can execute at most 5 tests in parallel, for example in the following combinations:

  • 3 * chrome, 2 * firefox
  • 2 * chrome, 2 * firefox, 1 * edge
  • 5 * edge
  • 3 * chrome

The following combinations are NOT possible:

  • 4 * chrome (exceeds Chrome maxInstances)
  • 6 * edge (exceeds maxSessions)
  • 3 * chrome, 3 * firefox (exceeds maxSessions)

As mentioned by Anuragh, MaxInstances applies to a specific browser, while MaxSessions applies to the entire node.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!