问题描述
我想知道是否有人可以阐明一个使我们有些头疼的Selenium
问题.
I was wondering if anybody could shed some light on a Selenium
question that has been giving us a bit of head scratching.
我们对Selenium Grid的MaxSession
和MaxInstances
的含义感到困惑.我们认为MaxSession
是可以在单个节点上运行的测试会话的总数.而且我们还认为MaxInstances
是测试可以打开的浏览器总数.
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.
或者MaxInstances
该节点可用的浏览器总数是多少?
Or is MaxInstances
the total number of browsers available to the node?
我们正在使用的命令是:
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"
我们认为(上面)使用节点的方式默认为5个并发测试会话.
We think the way we are using our node (above) is 5 concurrent test sessions by default.
每个测试都可以使用20个浏览器吗?
还是每个测试会话与其他测试会话共享一个池中的20个浏览器(10 chrome/10 FF)?
推荐答案
很好的问题....我会说这有点令人困惑....但是会尝试用简单的方式回答..
Nice question....i would say it's bit confusing.... But will try to answer it in simple terms..
MaxInstances 这表示....同一浏览器版本可以在远程系统上运行多少个实例.
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
因此,我可以在远程计算机上同时运行5个Firefox 12实例和5个IE9实例.因此,总用户可以并行运行10个不同浏览器(FF12和IE9)的实例.
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 这表示....一次可以在一个浏览器中并行运行多少个浏览器(任何浏览器和任何版本).远程系统.因此,这会覆盖最大实例数"设置,并会限制可以并行运行的浏览器实例的数量.
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).
无论您定义了什么MaxInstances.
Irrespective of what MaxInstances you have defined.
有关更清晰的信息,请访问- https://seleniumhq.github.io/docs/grid .html
For more clear info do visit - https://seleniumhq.github.io/docs/grid.html
这篇关于Selenium Grid:MaxSessions与MaxInstances的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!