selenium - 除了 http://localhost:4444/grid/console 之外,有没有办法通过 Selenium Grid 获取注册节点的数量
问题描述
为了并行运行多个测试,我想知道有多少节点已经在某个时候运行。
我查看了很多关于这个主题的帖子,但所有帖子都包括使用http://localhost:4444/grid/console:我不想查看这个页面。我正在考虑每次创建节点时向集线器发送一条消息。因此集线器会增加其计数。但我找不到办法做到这一点。
有没有人有不同的解决方案?也许使用 seleniumgrid 参数或命令,我很惊讶这个数字没有存储在某个地方?
解决方案
selenium 网格有一个 API。你可以这样做:
http://hub_ip_address:4444/grid/api/hub
并解析它为“slotCounts”返回的 json
{
"success":true,
"capabilityMatcher":"org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"newSessionWaitTimeout":-1,
"throwOnCapabilityNotPresent":true,
"registry":"org.openqa.grid.internal.DefaultGridRegistry",
"cleanUpCycle":5000,
"custom":{
},
"host":"XX.XXX.XX.XXX",
"maxSession":10,
"servlets":[
"ConsoleServlet"
],
"withoutServlets":[
],
"browserTimeout":0,
"debug":false,
"port":4444,
"role":"hub",
"timeout":300000,
"enablePassThrough":true,
"newSessionRequestCount":0,
"slotCounts":{
"free":9,
"total":12
}
}
推荐阅读
- sql - Postgres - 检索内部连接最旧的记录
- ios - 相等的矩形动画不同?
- liferay - 哪些表有Liferay中所有页面标题和liferay导航菜单标题的信息
- c# - 如何让 FxCopAnalyzers 跳过 Specflow AssemblyHooks 警告
- karate - 有没有一种好方法可以将空手道用于依赖于数据库状态的测试?
- jwt - JWT 的所有权证明
- reactjs - 将状态从主页传递到导航栏和条件渲染
- python - 如何使用 pytest xfail 断言异常消息(异常类型的断言有效)
- angular - 如何将动态点击事件绑定到 *ngFor 中的动态模板 ref/var?
- reactjs - 未处理的拒绝(TypeError):无法读取未定义的属性“项目”