使用Selenium Grid进行并行测试时,maxSession和maxInstances有什么区别 [英] What is the difference between maxSession and maxInstances when using Selenium Grid for parallel testing
问题描述
我是硒网格的新手.所以有人可以向我解释 maxSession
和 maxInstances
之间的区别.一个节点可以使用多少个并行浏览器?
按照
-maxSession
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?
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:
这篇关于使用Selenium Grid进行并行测试时,maxSession和maxInstances有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!