webdriverIO test on sauceLabs is not working for firefox

606 Views Asked by At

I am trying to run a wdio-test on saucelabs for chrome, IE and firefox.

test works fine for chrome and IE, however it fails for firefox with :

Infrastructure Error -- The Sauce VMs failed to start the browser or device.

I am using lastest version of wdio and sauce service:

  "devDependencies": {
    "@wdio/cli": "^6.1.5",
    "@wdio/cucumber-framework": "^6.1.1",
    "@wdio/local-runner": "^6.1.5",
    "@wdio/sauce-service": "^6.1.0",
    "@wdio/spec-reporter": "^6.1.5",
    "@wdio/sync": "^6.1.5",
    "chromedriver": "^81.0.0",
    "wdio-chromedriver-service": "^6.0.2"
  }

my browser config:

capabilities: [
    {
      maxInstances: 3,
      browserName: "chrome",
      browserVersion: "latest"
    },
    {
      maxInstances: 3,
      browserName: "firefox",
      browserVersion: "latest",
      platform: "windows 10",
      "sauce:options": {
        seleniumVersion: "3.14.0",
      },
    },
    {
      maxInstances: 3,
      browserName: "internet explorer",
      browserVersion: "latest"
    },
  ],

2

There are 2 best solutions below

2
joshin4colours On

This is an issue with how WebdriverIO and Sauce Labs handle W3C browser options. You do need to provide a sauce:options capability to use recent versions of Firefox, which would look like this:

capabilities: { 
  maxInstances: 3,
  browserName: 'firefox',
  platformName: 'Windows 10', 
  browserVersion: 'latest', 
  'sauce:options': 
    {'seleniumVersion': '3.14.0'}
}

The sauce:options specifies Sauce-only capabilities, such as which version of Selenium WebDriver to use in this case.

0
akshaymittal143 On

I was able to fix it.

In order for the W3C-compliant Selenium capabilities and protocol to work, all non-standard capabilities need to be defined inside the "sacue:options" block. This includes the "build" capability. Also, to specify a platform, the capability name has been changed from "platform" to "platformName". So the capabilities should look like this:

capabilities: { 
  browserName: 'firefox',
  platformName: 'Windows 10', 
  browserVersion: 'latest', 
  'sauce:options': 
    {
    'seleniumVersion': '3.14.0',
    'build': buildName()
    }
}