[英]Chrome Browser Version In Selenium
I have set up one Selenium Grid with one Hub in Ubuntu Server and one Node in Ubuntu Desktop .我在 Ubuntu Server 中设置了一个带有一个集线器的Selenium 网格,在 Ubuntu Desktop 中设置了一个节点。 Google Chrome version on Node is Version 85.0.4183.83 (Official Build) (64-bit)
. Node上的Google Chrome版本是Version 85.0.4183.83 (Official Build) (64-bit)
。 And my python code for creating session is我创建会话的python代码是
# Add Chrome options
options = webdriver.ChromeOptions()
options.add_argument("--disable-extensions")
options.set_capability("browserVersion", "85.0.4183.83")
options.set_capability("platformName", "linux")
# Open a remote browser Session
driver = webdriver.Remote(
command_executor='http://192.168.56.7:4444/wd/hub',
options=options
)
But when I am passing options.set_capability("browserVersion", "85.0.4183.83")
it gives error但是当我通过options.set_capability("browserVersion", "85.0.4183.83")
它给出错误
selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session cannot find : Capabilities {browserName: chrome, browserVersion: 85.0.4183.83, goog:chromeOptions: {args: [--disable-extensions], extensions: []}, platformName: linux, version: } selenium.common.exceptions.WebDriverException:消息:无法找到转发新会话的错误:功能{browserName:chrome,browserVersion:85.0.4183.83,goog:chromeOptions:{args:[--disable-extensions],扩展:[]} ,平台名称:linux,版本:}
But without that line, it works absolutely fine.但是没有那条线,它工作得很好。
Also, like to know if there is any option of passing only the Major version of the browser like 85
without passing the exact version number like 85.0.4183.83
.另外,想知道是否有任何选项可以只传递浏览器的主要版本(如85
而不传递确切的版本号(如85.0.4183.83
。
Thanks to all in advance.提前感谢大家。
Solved the issue.解决了这个问题。 As the version information is not passed on to the HUB it is cannot verify the version information.由于版本信息未传递到HUB ,因此无法验证版本信息。 So have to pass nodeConfig when connecting to HUB from the NODE .所以从NODE连接到HUB时必须通过nodeConfig 。
node-config.json节点配置文件
{
"capabilities": [
{
"browserName": "firefox",
"browserVersion": "79.0"
},
{
"browserName": "chrome",
"browserVersion": "85.0"
}
]
}
Then start the connection using然后使用开始连接
java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://[HUB-IP]:4444/grid/register/ -nodeConfig node-config.json
Now passing options.set_capability("browserVersion", "85.0")
will work.现在传递options.set_capability("browserVersion", "85.0")
将起作用。 So using this you can now specify which OS , Browser , and Browser Version you want to test on.因此,使用它,您现在可以指定要测试的OS 、 Browser和Browser Version 。
Ref:- https://www.selenium.dev/documentation/en/grid/grid_3/setting_up_your_own_grid/参考:- https://www.selenium.dev/documentation/en/grid/grid_3/setting_up_your_own_grid/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.