What is the difference between maxSession and maxInstances when using Selenium Grid for parallel testing

我的梦境 提交于 2021-01-29 14:28:36

问题


I am new to selenium grid. So can someone please explain me the difference between the maxSession and maxInstances. And also how many parallel browsers can be used in one node?


回答1:


As per the documentation by default, starting a Selenium Grid Node allows for concurrent use of 11 browsers, comprising of 5 Firefox, 5 Chrome and 1 Internet Explorer browser.

The maximum number of concurrent tests is set to 5 by default. To change this configuration 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. 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
    
  • Grid Console Snapshot:


-maxSession

-maxSession is also an optional parameter which can be passed through the -browser optional parameter to configure the maximum number of browsers that can run in parallel on the 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
  • Grid Console Snapshot:



来源:https://stackoverflow.com/questions/60204777/what-is-the-difference-between-maxsession-and-maxinstances-when-using-selenium-g

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