简体   繁体   English

Selenium 中的 Chrome 浏览器版本

[英]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.因此,使用它,您现在可以指定要测试的OSBrowserBrowser 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.

相关问题 ssh 上的 Selenium Chrome 浏览器 - Selenium Chrome browser on ssh 此版本 ChromeDriver 仅支持 Chrome 版本 97 当前浏览器版本为 96.0.4664.45 使用 Selenium 和 Chrome 出现二进制路径错误 - This version of ChromeDriver only supports Chrome version 97 Current browser version is 96.0.4664.45 with binary path error using Selenium and Chrome 硒铬浏览器登录控制台 - selenium chrome browser logging in console 假设焦点在Selenium chrome浏览器中 - Feign focus in Selenium chrome browser 如何在 Chrome 浏览器通过 Python selenium 自动更新时使用特定版本的 ChromeDriver - How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium 如何使用 python 在 selenium 中安装特定于本地 chrome 浏览器版本的 chromedriver? - how to install chromedriver specific to local chrome browser version in selenium using python? python硒无法与chrome驱动程序和chrome版本一起运行 - python selenium not running with chrome driver & chrome version 将Chrome浏览器更新到最新版本后无法打开Chrome浏览器 - not opening chrome browser after updating Chrome browser to latest version 如何通过Chromedriver和Selenium启动Chrome浏览器 - How to start Chrome Browser through Chromedriver and Selenium Python Selenium:提取Chrome和Firefox浏览器的PID - Python Selenium: Extracting the PID of Chrome and Firefox browser
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM