question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiremote config errors due to capabilities values - Illegal key values seen in w3c capabilities: [hostname, path, port, protocol]

See original GitHub issue

Environment (please complete the following information):

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:

  1. Set the capabilities in wdio.conf.js to:
capabilities:
{
        chromeBrowser: {
            capabilities: {
                browserName: 'chrome'
            }
        },
        firefoxBrowser: {
            capabilities: {
                browserName: 'firefox'
            }
        }
    },
  1. Ensure services includes selenium-standalone:
services: [
        ['selenium-standalone', { drivers: { firefox: '0.28.0', chrome: true, chromiumedge: 'latest' } }]
    ],
  1. 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:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
matthew-johnstoncommented, Apr 5, 2021

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 line Object.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

1reaction
christian-bromanncommented, Apr 9, 2021

Thanks for providing an reproducible example. I Was able to spot the problem and provide a fix. Let’s continue convo in the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request failed due to Illegal key values seen in w3c capabilities
I hardcoded my user & key to check if it solves the issue and it did. The message of the error should be...
Read more >
Webdriverio Illegal Capabilities IEDriver - Stack Overflow
Running webdriverio with the below configs results in the error: Illegal key values seen in w3c capabilities: [hostname, path, port, ...
Read more >
webdriverio/webdriverio - Gitter
I added 'ms:' to binary because I was getting the following error: Illegal key values seen in w3c capabilities: [binary] Make sure to...
Read more >
Illegal key values seen in w3c capabilities ...
When I define skipServerInstallation UiAutomator2 capability I got illegal key issue. I am facing this issue with some capabilities like ...
Read more >
Configuration - WebdriverIO
WebDriver Options​ · protocol​ · hostname​ · port​ · path​ · queryParams​ · user​ · key​ · capabilities​.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found