Capabilities

Capabilities

Before we can send any command to the browser we drive we need to create a WebDriver session. This should be always the first step of interaction using the protocol. To create a new session we need to provide some requirements like browserName, browserVersion, platformName. These requirements are called Capabilities. This is especially important when we interact not directly with a single browser but with a grid of browsers. Using alwaysMatch property we can provide some strict requirements. If the WebDriver sever can't provide the required features the session creation will fail. Using firstMatch property we can provide a list of requirements. During session creation the server will pick the first capability it's able to match. firstMatch can of course be combined with alwaysMatch to narrow down the selection.

PROPERTIES

EXAMPLES

const capabilities = {
  alwaysMatch: {
    browserName: 'firefox',
    browserVersion: '60'
  }
}
const capabilities = {
  firstMatch: [
    { browserName: 'chrome' },
    { browserName: 'firefox' }
  ]
}

SEE ALSO

BrowserCapability

PROPERTIES

  • browserName?: string

  • browserVersion?: string

  • platformName?: string

  • acceptInsecureCerts?: boolean

  • pageLoadStrategy: 'none' | 'eager' | 'normal'

  • unhandledPromptBehavior: 'dismiss' | 'accept' | 'dismiss and notify' | 'accept and notify' | 'ignore'

  • goog:chromeOptions?: ChromeOptions

  • moz:firefoxOptions?: FirefoxOptions

  • bstack:options?: BrowserStackOptions

ChromeOptions

PROPERTIES

  • w3c?: boolean

  • binary?: string

  • args?: string[]

FirefoxOptions

PROPERTIES

  • binary?: string

  • args?: string[]

  • profile?: string

  • log?: object

    • level?: string

  • prefs?: object

SEE ALSO

InternetExplorerOptions

PROPERTIES

  • ignoreProtectedModeSettings: boolean

  • ignoreZoomSetting: boolean

  • ie.ensureCleanSession: boolean

BrowserStackOptions

PROPERTIES

  • os?: string

  • osVersion?: string

  • sessionName?: string

  • buildName?: string

  • projectName?: string

  • debug?: boolean

  • networkLogs?: boolean

  • local?: boolean

  • seleniumVersion?: string

  • safari?: object

    • enablePopups?: boolean

    • useSimulator?: boolean

    • allowAllCookies?: boolean

    • driver?: string

Last updated