seleniumelectronselenium-chromedrivergeckodriverwdio-v6

How to handle when electron app and chrome browser capabilities require different versions of chromedriver


My test environment has below setup:

By using selenium-standalone service, I am trying to create 1 electron and 1 chrome browser sessions with below 2 capabilities:

Capability #1 - electron session

capabilities: {
        browserName: 'chrome',
        'goog:chromeOptions': {
          binary: 'Path to Electron binary’
          args: [
            /* cli arguments */
          ], // Optional, perhaps 'app=' + /path/to/your/app/
        },
      },

Capability #2 - chrome browser session

capabilities: {
        browserName: 'chrome',
        'goog:chromeOptions': {
          args: […],
        },

With selenium-standalone service, if I have following chromedriver version in installArgs and args:

drivers: {
            chrome: { version: '100.0.4896.60' }, 
          },

Capability#2 would fail to create session for chrome browser.

If I have

drivers: {
            chrome: { version: 'latest' }, 
          },

Capability#1 would fail to create session for electron app

I also tried setting the capability #2 to firefox browser instead of chrome: capabilities: { browserName: 'firefox' }

with selenium-standalone installArg and args:

drivers: {
        chrome: { version: '100.0.4896.60' },  // match electron app version
        firefox: { version: 'latest' }, // match firefox browser version
      }

Electron app session was created but firefox session still failed to create with below error:

[0-0] 2022-06-03T07:48:28.519Z ERROR @wdio/runner: Error: Failed to create session.
Unable to create session from {
  "desiredCapabilities": {
    "moz:firefoxOptions": {
      "args": [
        "-remote-debugging-port",
        "50030"
      ]
    },
    "browserName": "firefox"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "firefox",
        "moz:firefoxOptions": {
          "args": [
            "-remote-debugging-port",
            "50030"
          ]
        }
      }
    ]
  }
}
  Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
        System info: host: '-----', ip: '----', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_231'
        Driver info: driver.version: unknown
            at Object.startWebDriverSession (~/node_modules/webdriver/build/utils.js:34:15)
            at processTicksAndRejections (internal/process/task_queues.js:97:5)

Any suggestions on workaround would be appreciated. Thank you


Solution

  • It seems like I cannot have multiple versions of chromedriver but I can get the Capability#2 to work by changing to firefox. I was having above driver unknown error because I specified the selenium version 3.141.59 in args but not in installArgs. Once removing/adding 3.141.59 from both args and installArgs, Firefox was working as expected. Please see below:

     'selenium-standalone',
          {
            logPath: 'logs',
            installArgs: {
              version: '3.141.59',
              drivers: {
                chrome: { version: '100.0.4896.60' }, 
                firefox: { version: '0.30.0' }, 
              },
            },
            args: {
              version: '3.141.59',
              drivers: {
                chrome: { version: '100.0.4896.60' },
                firefox: { version: '0.30.0' },
              },
            },
          },