Skip to main content

Capabilities

A capability is a definition for a remote interface. It helps WebdriverIO to understand in which browser or mobile environment you like to run your tests on. Capabilities are less crucial when developing tests locally as you run it on one remote interface most of the time but becomes more important when running a large set of integration tests in CI/CD.

info

The format of a capability object is well defined by the WebDriver specification. The WebdriverIO testrunner will fail early if user defined capabilities do not adhere to that specification.

Custom Capabilities

While the amount of fixed defined capabilities is verry low, everyone can provide and accept custom capabilities that are specific to the automation driver or remote interface:

Browser Specific Capability Extensions

  • goog:chromeOptions: Chromedriver extensions, only applicable for testing in Chrome
  • moz:firefoxOptions: Geckodriver extensions, only applicable for testing in Firefox
  • ms:edgeOptions: EdgeOptions for specifying the environment when using EdgeDriver for testing Chromium Edge

Cloud Vendor Capability Extensions

Automation Engine Capability Extensions

Have a look into WebdriverIOs Capability TypeScript definition to find specific capabilities for your test. Note: not all of them are still valid and might not be supported anymore by the provider.

Special Capabilities for Specific Use Cases

This is a list of examples showing which capabilities need to be applied to achieve a certain use case.

Run Browser Headless

Running a headless browser means to run a browser instance without window or UI. This is mostly used within CI/CD environments where no display is used. To run a browser in headless mode, apply the following capabilities:

{
browserName: 'chrome',
'goog:chromeOptions': {
args: ['headless', 'disable-gpu']
}
}
    browserName: 'firefox',
'moz:firefoxOptions': {
args: ['-headless']
}
    browserName: 'msedge',
'ms:edgeOptions': {
args: ['--headless']
}

It seems that Safari doesn't support running in headless mode.