Multiremote config errors due to capabilities values - Illegal key values seen in w3c capabilities: [hostname, path, port, protocol]
See original GitHub issueEnvironment (please complete the following information):
- WebdriverIO version: 7.3.0
- Mode: WDIO Testrunner
- If WDIO Testrunner, running sync/async: sync
- Node.js version: 12.18.3
- NPM version: 6.14.6
- Browser name and version: Chrome 89.0.4389.114
- Platform name and version: Mac OS Catalina 10.15.7
- Additional wdio packages used (if applicable):
- @wdio/spec reporter, @wdio/selenium-standalone service, @wdio/mocha-framework, @wdio/sync, @wdio/local-runner
Config of WebdriverIO
runner: 'local',
specs: [
'./webdriver/tests/**.ts'
],
exclude: [
// 'path/to/excluded/files'
],
autoCompileOpts: {
autoCompile: true,
// see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
// for all available options
tsNodeOpts: {
transpileOnly: true,
project: './webdriver/tsconfig.json'
},
// tsconfig-paths is only used if "tsConfigPathsOpts" are provided, if you
// do please make sure "tsconfig-paths" is installed as dependency
tsConfigPathsOpts: {
baseUrl: './'
}
},
maxInstances: 10,
automationProtocol: 'webdriver',
path: '/wd/hub',
capabilities:
{
chromeBrowser: {
capabilities: {
browserName: 'chrome'
}
},
firefoxBrowser: {
capabilities: {
browserName: 'firefox'
}
}
},
logLevel: 'info',
bail: 0,
baseUrl: 'http://www.google.com/',
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
services: [
['selenium-standalone', { drivers: { firefox: '0.28.0', chrome: true, chromiumedge: 'latest' } }]
],
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 60000
}
}
Describe the bug
When configured for multiremote and selenium-standalone, running the tests throws the error ERROR webdriver: unknown error: Illegal key values seen in w3c capabilities: [hostname, path, port, protocol]
. The session data is logged as follows:
[0-0] 2021-04-02T20:11:06.899Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2021-04-02T20:11:06.900Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session
[0-0] 2021-04-02T20:11:06.900Z INFO webdriver: DATA {
capabilities: {
alwaysMatch: {
browserName: 'chrome',
protocol: 'http',
hostname: 'localhost',
port: 4444,
path: '/wd/hub'
},
firstMatch: [ {} ]
},
desiredCapabilities: {
browserName: 'chrome',
protocol: 'http',
hostname: 'localhost',
port: 4444,
path: '/wd/hub'
}
}
If I run the tests without the multiremote configuration, they are successful. The session data is as follows:
[1-0] 2021-04-02T20:19:40.685Z INFO webdriver: Initiate new session using the WebDriver protocol
[1-0] 2021-04-02T20:19:40.686Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session
[0-0] 2021-04-02T20:19:40.687Z INFO webdriver: Initiate new session using the WebDriver protocol
[1-0] 2021-04-02T20:19:40.686Z INFO webdriver: DATA {
capabilities: {
alwaysMatch: { browserName: 'chrome', acceptInsecureCerts: true },
firstMatch: [ {} ]
},
desiredCapabilities: { browserName: 'chrome', acceptInsecureCerts: true }
}
[0-0] 2021-04-02T20:19:40.688Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session
[0-0] 2021-04-02T20:19:40.688Z INFO webdriver: DATA {
capabilities: {
alwaysMatch: {
browserName: 'firefox',
acceptInsecureCerts: true,
'moz:firefoxOptions': [Object]
},
firstMatch: [ {} ]
},
desiredCapabilities: {
browserName: 'firefox',
acceptInsecureCerts: true,
'moz:firefoxOptions': { args: [Array] }
}
}
To Reproduce
Update (04/08):
pull the following and run npx wdio run wdio.conf.js
from the e2e-tests
directory:
https://github.com/amandaflagg/multiremote-bug
Original information: Steps to reproduce the behavior:
- Set the capabilities in wdio.conf.js to:
capabilities:
{
chromeBrowser: {
capabilities: {
browserName: 'chrome'
}
},
firefoxBrowser: {
capabilities: {
browserName: 'firefox'
}
}
},
- Ensure services includes selenium-standalone:
services: [
['selenium-standalone', { drivers: { firefox: '0.28.0', chrome: true, chromiumedge: 'latest' } }]
],
- Start test run
Expected behavior Setting capabilities to enable multiremote in wdio.conf.js should run just as a non-multiremote config does. I’m unsure where the values are coming from that cause an error in capabilities when running multiremote.
Log https://gist.github.com/amandaflagg/60f6326b5347f6d1e77b58cdc550a5dd
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
I have the exact same issue you’re seeing. I found a temporary workaround/hack you can use. Try setting an empty
sauce:options
object in your capabilities. Selenium standalone treats it as a cloud capability and doesn’t run this lineObject.assign(c, DEFAULT_CONNECTION, { ...c })
. Very hacky, but it might unblock you until this is fixed.if (!isCloudCapability(c) && hasCapsWithSupportedBrowser(c)) { Object.assign(c, DEFAULT_CONNECTION, { ...c }) }
https://github.com/webdriverio/webdriverio/blob/9d2220e89144b0ca69232737957ad5fc32ca1300/packages/wdio-selenium-standalone-service/src/launcher.ts#L87
https://github.com/webdriverio/webdriverio/blob/9d2220e89144b0ca69232737957ad5fc32ca1300/packages/wdio-config/src/utils.ts#L34
Thanks for providing an reproducible example. I Was able to spot the problem and provide a fix. Let’s continue convo in the PR.