有没有办法让 Selenium Grid 2 DesiredCapability 与浏览器无关?
我想知道 Selenium 集线器是否有一种(最好是内置的)方式来请求具有任何可用浏览器的节点。基本上,我希望我的集线器指定类似“BrowserName = 'any'”的内容,匹配运行实例数少于其 maxInstances 的节点,然后让节点决定在哪个浏览器上运行。
其背后的动机是,我希望最大限度地增加在任何给定节点上并行运行的测试数量,而无需任何一个浏览器的多个实例。我不关心任何给定的测试正在运行哪个浏览器。
作为参考,我目前使用的是 selenium 服务器 2.17。
I'm wondering if there's a (preferably built-in) way for Selenium hubs to ask for nodes that have any browser available. Basically, I want my hub to specify something like "BrowserName = 'any'", match on a node that is running less instances than its maxInstances, then let the node decide which browser to run on.
The motivation behind this is that I want to maximize the number of tests running in parallel on any given node without having multiple instances of any one browser. I don't care which browser is running for any given test.
As a reference, I'm currently using selenium server 2.17.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯,这很烦人。
我相当确定有一个命令行参数可以让您覆盖指定的 browserName,但现在我找不到它。
如果我的记忆还不错,该参数可以让您或多或少地执行您所要求的操作 - 无论节点说它拥有什么浏览器,也无论集线器要求什么,总是启动一个特定的浏览器。
自我提示:为 selenium 启动所有命令行选项的正确列表,并可能将其提交给团队以包含在 wiki 中。
在任何情况下实现此目的的一种方法是编写您自己的“CapabilityMatcher”类 - 但这可能不是一个选项,除非您想创建自定义 JAR,并且您希望 hub 执行此操作浏览器的变化,而不是单个节点的变化。
Ack, this is annoying.
I'm fairly sure there's a command line parameter that let's you override the specified browserName, but now I can't find it.
If my memory is not way off, the parameter let you do more or less what you are asking for - regardless of what browsers the node says it has, and regardless of what the hub asks for, one particular browser is always started.
Note to self: start a proper list of all command line options for selenium, and possibly submit it to the team for inclusion in the wiki.
One way to achieve this in any case would be to write a your own "CapabilityMatcher" class - but that may not be an option unless you want to create a custom JAR, and you want teh hub to do the change of browser, rather than the individual nodes.
在这里:
java -jar selenium-server-standalone-2.14.0.jar -role node -hub http://localhost:4444/grid/register -maxSession 3 -browser browserName=firefox,maxInstances=1 -浏览器 browserName=chrome,maxInstances=1 ...
Here you go:
java -jar selenium-server-standalone-2.14.0.jar -role node -hub http://localhost:4444/grid/register -maxSession 3 -browser browserName=firefox,maxInstances=1 -browser browserName=chrome,maxInstances=1
...