Webdriverio Selenium 独立服务 v6 及更高版本 - 无法覆盖私有 Selenium 后端的主机名

Webdriverio Selenium Standalone Service v6 onwards - unable to overwrite the hostname for private Selenium backend

Webdriverio Test Runner 有一个选项 - 如果您使用私有 Selenium 后端,则应在此处定义 hostnameportpath

hostname: 'localhost',
port: 4444,
path: '/',

自版本:“@wdio/selenium-standalone-service”:“^6.0.0” 这个 "hostname" 是不可更改的,并且始终保持为本地主机。它似乎自动检测到它应该只是本地主机并且根本不引用配置,即即使我在 wdio.conf.js 中手动更新为

主机名:'selenium-hub', 端口:4445, 路径:'/',

执行后,主机名仍然是 'localhost' 而不是 'selenium-hub',端口仍然是“4444”而不是“4445”

在以前的版本中,带有 --hostname 的命令行值已按要求成功覆盖

即./node_modules/.bin/wdio wdio.conf.js --主机名'selenium-hub'

将 selenium-hub 作为主机名成功传递....

有人遇到类似问题吗?

将主机名、端口和路径添加到功能数组。

而不是:

 hostname: '{ unique ip address}',
    port: { port number },
    path: {'/'},
    protocol: '{http' || 'https'},

 capabilities: [{
    maxInstances: 5,
    browserName: 'chrome',
  
}],

这样做:

能力:[{[​​=12=]

maxInstances: 5,
browserName: 'chrome',
hostname: '{ unique ip address}',
port: { port number },
path: {'/'},
protocol: '{http' || 'https'},

}],