Detalhes do pacote

@testplane/webdriver

webdriverio6.1kMIT9.5.12

A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol

webdriver

readme (leia-me)

WebDriver

A lightweight, non-opinionated implementation of the WebDriver and WebDriver BiDi specification including mobile commands supported by Appium

There are tons of Selenium and WebDriver binding implementations in the Node.js world. Every one of them has an opinionated API and recommended way to use it. This binding is the most non-opinionated you will find as it just represents the WebDriver specification and doesn't come with any extra or higher-level abstraction. It is lightweight and comes with support for the WebDriver specification and Appium's Mobile JSONWire Protocol.

The package supports the following protocols:

Commands are added to the client's protocol based on assumptions of provided capabilities. You can find more details about the commands by checking out the @testplane/wdio-protocols package. All commands come with TypeScript support.

Install

To install this package from NPM run:

npm i webdriver

WebDriver Example

The following example demonstrates a simple Google Search scenario:

import WebDriver from '@testplane/webdriver';

const client = await WebDriver.newSession({
    path: '/',
    capabilities: { browserName: 'firefox' }
})

await client.navigateTo('https://www.google.com/ncr')

const searchInput = await client.findElement('css selector', '#lst-ib')
await client.elementSendKeys(searchInput['element-6066-11e4-a52e-4f735466cecf'], 'WebDriver')

const searchBtn = await client.findElement('css selector', 'input[value="Google Search"]')
await client.elementClick(searchBtn['element-6066-11e4-a52e-4f735466cecf'])

console.log(await client.getTitle()) // outputs "WebDriver - Google Search"

await client.deleteSession()

WebDriver Bidi Example

To connect to the WebDriver Bidi protocol you have to send along a webSocketUrl flag to tell the browser driver to opt-in to the protocol:

import WebDriver from '@testplane/webdriver'

const browser = await WebDriver.newSession({
    capabilities: {
        webSocketUrl: true,
        browserName: 'firefox'
    }
})

await browser.sessionSubscribe({ events: ['log.entryAdded'] })

/**
 * returns: {"type":"console","method":"log","realm":null,"args":[{"type":"string","value":"Hello Bidi"}],"level":"info","text":"Hello Bidi","timestamp":1657282076037}
 */
browser.on('log.entryAdded', (entryAdded) => console.log('received %s', entryAdded))

await browser.executeScript('console.log("Hello Bidi")', [])
await browser.deleteSession()

Configuration

To create a WebDriver session call the newSession method on the WebDriver class and pass in your configurations:

import WebDriver from '@testplane/webdriver'
const client = await WebDriver.newSession(options)

The following options are available:

capabilities

Defines the capabilities you want to run in your WebDriver session. Note: by default, it will automatically set the webSocketUrl to establish a WebDriver Bidi session, if you don't want this, make sure to set 'wdio:enforceWebDriverClassic': true in your capabilities.

Type: Object
Required: true

logLevel

Level of logging verbosity.

Type: String
Default: info
Options: trace | debug | info | warn | error | silent

protocol

Protocol to use when communicating with the Selenium standalone server (or driver).

Type: String
Default: http Options: http | https

hostname

Host of your WebDriver server.

Type: String
Default: localhost

port

Port your WebDriver server is on.

Type: Number
Default: undefined

path

Path to WebDriver endpoint or grid server.

Type: String
Default: /

queryParams

Query parameters that are propagated to the driver server.

Type: Object Default: undefined

connectionRetryTimeout

Timeout for any WebDriver request to a driver or grid.

Type: Number
Default: 120000

connectionRetryCount

Count of request retries to the Selenium server.

Type: Number
Default: 3

agent

Allows you to use a customhttp/https/http2 agent to make requests.

Type: Object
Default:

{
    http: new http.Agent({ keepAlive: true }),
    https: new https.Agent({ keepAlive: true })
}

transformRequest

Function intercepting HTTP request options before a WebDriver request is made to a driver.

Type: (RequestOptions) => RequestOptions
Default: none

transformResponse

Function intercepting HTTP response objects after a WebDriver response has arrived.

Type: (Response, RequestOptions) => Response
Default: none

changelog (log de mudanças)

Changelog

Tags:

  • :boom: [Breaking Change]
  • :eyeglasses: [Spec Compliancy]
  • :rocket: [New Feature]
  • :bug: [Bug Fix]
  • :memo: [Documentation]
  • :house: [Internal]
  • :nail_care: [Polish]

Note: Gaps between patch versions are faulty, broken or test releases.

See CHANGELOG - v4.

See CHANGELOG - v5.

See CHANGELOG - v6

See CHANGELOG - v7

See CHANGELOG - v8


v9.16.0 (2025-06-23)

:eyeglasses: Spec Compliancy

:rocket: New Feature

  • wdio-config, wdio-runner, wdio-types

:bug: Bug Fix

:nail_care: Polish

  • wdio-browserstack-service
    • #14538 Added support for running accessibility on Non-browserstack infrastructure (@Bhargavi-BS)

:memo: Documentation

  • Other
  • wdio-appium-service, wdio-cli, wdio-protocols, wdio-types, webdriverio

:house: Internal

Committers: 10

v9.15.0 (2025-05-30)

:rocket: New Feature

  • wdio-logger, wdio-runner, wdio-types, webdriver, webdriverio
    • #13938 feat(runner+browserstack): Mask sensitive data for Reporters (and more) (@dprevost-LMI)
  • wdio-protocols

:bug: Bug Fix

:nail_care: Polish

:memo: Documentation

  • webdriverio

Committers: 7

v9.14.0 (2025-05-15)

:rocket: New Feature

:bug: Bug Fix

  • wdio-spec-reporter
    • #14472 chore(@wdio/spec-reporter): file name print format (@unickq)

:nail_care: Polish

  • wdio-types
    • #14474 add browserstack camera-image-injection to wdio-types capabilities (@DoreyKiss)
  • wdio-browserstack-service
    • #14466 Added changes to skip tests for mocha framework for browserstack session (@pri-gadhiya)

:house: Internal

  • wdio-types
    • #14481 feat: adding check in normalizeDoc function to make sure readmeArr is of string type (@Kauanldsbarbosa)

Committers: 5

v9.13.0 (2025-05-12)

:eyeglasses: Spec Compliancy

  • wdio-protocols

:bug: Bug Fix

  • webdriver
    • #14463 fix(webdriver): stop cloning request so await response.json() can abort properly (@dprevost-LMI)
    • #14437 Fix avoid misleading BiDi connection failure message (@Rondleysg)
  • webdriverio
    • #14449 fix(bidi-dialog): only dismiss dialogs in active browsing context (@Rondleysg)
    • #14448 fix(bidi-dialog): only accept dialogs in active browsing context (@Rondleysg)
  • wdio-utils
    • #14427 fix: disable Chrome's password manager leak detection as it can block test execution (@erwinheitzman)
  • wdio-junit-reporter

:nail_care: Polish

  • wdio-allure-reporter, wdio-concise-reporter, wdio-reporter, wdio-spec-reporter
    • #14454 feat(reporter): add browserName function and use where required (@Delta456)
  • wdio-browserstack-service

:memo: Documentation

:house: Internal

Committers: 12

v9.12.7 (2025-04-21)

:bug: Bug Fix

Committers: 2

v9.12.6 (2025-04-17)

:rocket: New Feature

  • webdriver
    • 14350 feat: introduce defineConfig function to create a typed configuration object (@erwinheitzman)

:bug: Bug Fix

:nail_care: Polish

  • webdriverio
  • wdio-browserstack-service
    • #14410 fix(@wdio/browserstack-service): node fetch() failure over HTTPS_PROXY=<proxy_url> setup (@mitya555)
  • @wdio/config
    • 14351 polish(@wdio/config): decrease waitforInterval from 500 to 100 to improve execution speed (@erwinheitzman)

Committers: 4

v9.12.5 (2025-04-11)

:eyeglasses: Spec Compliancy

  • wdio-protocols
    • #14379 feat(@wdio/protocols): Add "options" parameter to "terminateApp" command (@Nyaran)

:bug: Bug Fix

  • webdriverio
    • #14406 fix(interception): Return raw non-binary responses without metadata wrapper (@Norva-bugged)
    • #14401 fix(#14368): desync puppeteer-core peer-dep version (@Badisi)
    • #14402 fix: unexpected token '?' on older browsers (@will-stone)
    • #14403 fix(element): improve checkVisibility fallback handling in element.isDisplayed (@paymand)
  • webdriver
    • #14391 fix(webdriver): undici fetch() failure with HTTPS_PROXY=<proxy_url> setup (@mitya555)
  • wdio-browserstack-service

:nail_care: Polish

  • wdio-utils
    • #14392 fix(utils): fix not to judged as screenshot the arg of switch* (@mato533)
  • wdio-browserstack-service

:memo: Documentation

  • webdriverio

Committers: 10

v9.12.4 (2025-04-05)

:bug: Bug Fix

  • webdriver
    • #14376 fix(webdriver): add timeout-related configurable options to ProxyAgent (@mitya555)

:nail_care: Polish

:memo: Documentation

:house: Internal

Committers: 5

v9.12.3 (2025-04-03)

:bug: Bug Fix

  • webdriverio
    • #14360 fix(interception): Properly handle binary response data in WebDriverInterception (@Norva-bugged)
    • #14338 fix: Fixes isDisplayed to always use default params for checkVisibility. (@damencho)
  • Other

:memo: Documentation

:house: Internal

  • wdio-allure-reporter, wdio-browser-runner, wdio-browserstack-service, wdio-cli, wdio-config, wdio-cucumber-framework, wdio-firefox-profile-service, wdio-jasmine-framework, wdio-lighthouse-service, wdio-mocha-framework, wdio-protocols, wdio-runner, wdio-types, wdio-utils, webdriver, webdriverio

Committers: 8

v9.12.2 (2025-03-27)

:rocket: New Feature

  • webdriver
    • #14304 feat(webdriver): support WebSocket options at the BiDi connection (@mato533)

:bug: Bug Fix

:nail_care: Polish

:memo: Documentation

  • Other
  • wdio-cli, wdio-protocols, wdio-sauce-service, wdio-spec-reporter, wdio-types
  • wdio-spec-reporter
    • #14306 updated spec reporter readme - sharable links value with valid sauce sharable link (@vjuturu)

Committers: 13

v9.12.1 (2025-03-20)

:bug: Bug Fix

:nail_care: Polish

  • wdio-cli
  • webdriver
  • wdio-browser-runner, webdriver
    • #14259 fix: Try to resolve ip addresses if no BiDi connection to the host could be established (@mykola-mokhnach)

:memo: Documentation

:house: Internal

Committers: 11

v9.12.0 (2025-03-11)

:rocket: New Feature

:nail_care: Polish

  • webdriverio

:memo: Documentation

  • Other
  • webdriverio
    • #14263 docs: mention that Chrome DevTools protocol is not installed by default and what package is required (@ianrenauld)

Committers: 4

v9.11.0 (2025-03-05)

:rocket: New Feature

  • wdio-cucumber-framework, wdio-reporter, wdio-spec-reporter

:bug: Bug Fix

:nail_care: Polish

:memo: Documentation

:house: Internal

  • #14215 fix(webdriverio): fix failing e2e tests due to language and timezone differences (@erwinheitzman)

Committers: 6

v9.10.1 (2025-02-25)

:bug: Bug Fix

  • wdio-junit-reporter, wdio-reporter, wdio-runner, wdio-spec-reporter, wdio-types, webdriver
  • wdio-browser-runner, wdio-cli, wdio-config, wdio-runner, wdio-utils, webdriverio

Committers: 2

v9.10.0 (2025-02-22)

:rocket: New Feature

:bug: Bug Fix

  • wdio-sauce-service

:nail_care: Polish

  • webdriverio
  • wdio-sauce-service
    • #14209 fix: Remove unused typings file on sauce service (@Nyaran)
    • #14207 Remove default values for tlsPassthroughDomains on sauce service (@Nyaran)

Committers: 3

v9.9.3 (2025-02-18)

:bug: Bug Fix

:nail_care: Polish

  • wdio-browserstack-service

Committers: 2

v9.9.2 (2025-02-18)

:bug: Bug Fix

:memo: Documentation

Committers: 3

v9.9.1 (2025-02-14)

:bug: Bug Fix

  • webdriverio
  • wdio-webdriver-mock-service, webdriverio

:nail_care: Polish

  • eslint-plugin-wdio
  • wdio-browser-runner, wdio-globals, wdio-jasmine-framework, wdio-runner

Committers: 2

v9.8.0 (2025-02-06)

:bug: Bug Fix

:nail_care: Polish

  • wdio-sauce-service, wdio-spec-reporter
    • #14130 Add support for Sauce Connect 5, drop support for Sauce Connect 4 (@budziam)
  • wdio-cli

Committers: 3

v9.7.3 (2025-02-05)

:bug: Bug Fix

:nail_care: Polish

  • wdio-cli

Committers: 2

v9.7.2 (2025-01-29)

:bug: Bug Fix

:nail_care: Polish

  • wdio-utils, webdriverio

:memo: Documentation

Committers: 4

v9.7.1 (2025-01-25)

:bug: Bug Fix

:memo: Documentation

  • wdio-cli
    • #14111 updating constants and services lists with wdio-roku-service refs (@jonyet)

Committers: 2

v9.7.0 (2025-01-24)

:bug: Bug Fix

:nail_care: Polish

Committers: 2

v9.6.4 (2025-01-24)

:nail_care: Polish

Committers: 1

v9.6.3 (2025-01-23)

:bug: Bug Fix

Committers: 1

v9.6.2 (2025-01-23)

:bug: Bug Fix

  • wdio-webdriver-mock-service, webdriverio
  • wdio-cli, wdio-types, webdriverio
  • wdio-mocha-framework, wdio-runner

:memo: Documentation

Committers: 2

v9.6.1 (2025-01-23)

:bug: Bug Fix

Committers: 2

v9.6.0 (2025-01-21)

:rocket: New Feature

  • wdio-browserstack-service
  • webdriver, webdriverio

:bug: Bug Fix

:nail_care: Polish

  • webdriverio

:memo: Documentation

Committers: 4

v9.5.7 (2025-01-12)

:bug: Bug Fix

Committers: 1

v9.5.6 (2025-01-12)

:bug: Bug Fix

Committers: 1

v9.5.5 (2025-01-10)

:bug: Bug Fix

Committers: 1

v9.5.4 (2025-01-10)

:bug: Bug Fix

:nail_care: Polish

Committers: 1

v9.5.3 (2025-01-09)

:bug: Bug Fix

Committers: 1

v9.5.2 (2025-01-09)

:bug: Bug Fix

:memo: Documentation

:house: Internal

Committers: 3

v9.5.1 (2025-01-03)

:bug: Bug Fix

  • webdriverio
  • wdio-appium-service
    • #13913 chore(appium-service): filter out Debugger attached as errorMessage (@Delta456)

:nail_care: Polish

  • wdio-appium-service
  • webdriver
    • #14020 fix(webdriver): allow BiDiCore to send declared headers (@navin772)

Committers: 4

v9.5.0 (2024-12-30)

:rocket: New Feature

:bug: Bug Fix

:nail_care: Polish

Committers: 2

v9.4.5 (2024-12-19)

:nail_care: Polish

Committers: 1

v9.4.4 (2024-12-19)

:nail_care: Polish

  • wdio-testingbot-service

:house: Internal

  • eslint-plugin-wdio, wdio-allure-reporter, wdio-appium-service, wdio-browser-runner, wdio-browserstack-service, wdio-cli, wdio-config, wdio-cucumber-framework, wdio-firefox-profile-service, wdio-globals, wdio-jasmine-framework, wdio-json-reporter, wdio-junit-reporter, wdio-lighthouse-service, wdio-local-runner, wdio-logger, wdio-mocha-framework, wdio-protocols, wdio-repl, wdio-reporter, wdio-runner, wdio-sauce-service, wdio-shared-store-service, wdio-smoke-test-cjs-service, wdio-smoke-test-service, wdio-spec-reporter, wdio-static-server-service, wdio-sumologic-reporter, wdio-testingbot-service, wdio-types, wdio-utils, wdio-webdriver-mock-service, webdriver, webdriverio

Committers: 2

v9.4.3 (2024-12-17)

:bug: Bug Fix

  • wdio-cli, wdio-config, wdio-local-runner, webdriver
  • wdio-utils, webdriver
  • wdio-types
    • #13988 wdio-types: add platformVersion field for BrowserStackCapabilities (@Delta456)

:nail_care: Polish

  • wdio-utils

Committers: 4

v9.4.2 (2024-12-12)

:bug: Bug Fix

:nail_care: Polish

  • wdio-cli
  • wdio-utils, webdriverio
  • wdio-browserstack-service, wdio-types

:memo: Documentation

Committers: 7

v9.4.1 (2024-11-27)

:bug: Bug Fix

Committers: 1

v9.4.0 (2024-11-26)

:rocket: New Feature

:bug: Bug Fix

:nail_care: Polish

Committers: 2

v9.3.1 (2024-11-22)

:rocket: New Feature

:nail_care: Polish

  • wdio-cucumber-framework
  • webdriverio

Committers: 3

v9.3.0 (2024-11-20)

:rocket: New Feature

:bug: Bug Fix

:nail_care: Polish

:memo: Documentation

  • #13903 chore(docs): add info setting up maxInstances and specs in docs (@harsha509)

Committers: 3

v9.2.15 (2024-11-14)

:nail_care: Polish

  • wdio-runner
    • #13878 fix(@wdio/runner): Respect excludes in capabilities in multiremote case. (@damencho)

Committers: 1

v9.2.14 (2024-11-14)

:rocket: New Feature

:nail_care: Polish

  • wdio-cucumber-framework, wdio-reporter, wdio-spec-reporter

Committers: 2

v9.2.12 (2024-11-11)

:bug: Bug Fix

:nail_care: Polish

Committers: 1

v9.2.11 (2024-11-07)

:bug: Bug Fix

  • webdriverio
    • #13863 fix(webdriverio): properly handle unresolved element on switchFrame input in non-BIDI scenario (@gavvvr)
    • #13857 fix(webdriverio): switchWindow supports exact window handle match (@jan-molak)
  • wdio-browserstack-service
    • #13858 fix: stacktrace for testobservability (@07souravkunda)
    • #13833 Build Unification - WDIO Mocha, Cucumber, Jasmine - Browserstack Test Observability, Accessibility & Percy (@amaanbs)

:nail_care: Polish

:memo: Documentation

Committers: 6

v9.2.10 (2024-11-05)

:bug: Bug Fix

:nail_care: Polish

Committers: 2

v9.2.9 (2024-11-01)

:bug: Bug Fix

  • wdio-appium-service

Committers: 1

v9.2.8 (2024-11-01)

:bug: Bug Fix

  • webdriverio
  • wdio-utils
    • #13796 feat(chromedriver): set NODE_OPTIONS empty to allow electron to work (@Delta456)

:nail_care: Polish

Committers: 2

v9.2.5 (2024-10-29)

:bug: Bug Fix

Committers: 2

v9.2.4 (2024-10-28)

:bug: Bug Fix

Committers: 1

v9.2.2 (2024-10-28)

:bug: Bug Fix

:nail_care: Polish

  • wdio-appium-service
  • wdio-protocols
  • webdriverio
    • #13793 feat: enhance newWindow function to support 'tab' or 'window' types (@harsha509)

:memo: Documentation

:house: Internal

Committers: 11

v9.2.0 (2024-10-12)

:house: Internal

Committers: 2

v9.1.6 (2024-10-10)

:bug: Bug Fix

Committers: 1

v9.1.5 (2024-10-10)

:bug: Bug Fix

Committers: 1

v9.1.4 (2024-10-09)

:bug: Bug Fix

  • webdriverio
    • #13751 fix(webdriverio): make name polyfill compatible with old browsers (@mhassan1)

Committers: 2

v9.1.3 (2024-10-08)

:bug: Bug Fix

:nail_care: Polish

  • webdriverio
  • webdriver

:house: Internal

Committers: 5

v9.1.2 (2024-09-28)

:bug: Bug Fix

:nail_care: Polish

  • wdio-types, webdriver
  • wdio-cli, wdio-sauce-service, wdio-spec-reporter, wdio-types, webdriverio

Committers: 3

v9.1.1 (2024-09-26)

:bug: Bug Fix

:nail_care: Polish

:memo: Documentation

Committers: 4

v9.1.0 (2024-09-24)

:rocket: New Feature

:bug: Bug Fix

:nail_care: Polish

  • wdio-utils, webdriver
  • wdio-appium-service, wdio-sauce-service, wdio-testingbot-service, wdio-utils, webdriver, webdriverio
  • wdio-spec-reporter, wdio-types, webdriverio
  • wdio-junit-reporter
  • wdio-browserstack-service

:memo: Documentation

Committers: 13

v9.0.8 (2024-09-05)

:rocket: New Feature

:bug: Bug Fix

  • webdriverio
  • Other
  • eslint-plugin-wdio, wdio-allure-reporter, wdio-appium-service, wdio-browser-runner, wdio-browserstack-service, wdio-cli, wdio-concise-reporter, wdio-config, wdio-cucumber-framework, wdio-dot-reporter, wdio-firefox-profile-service, wdio-globals, wdio-jasmine-framework, wdio-junit-reporter, wdio-lighthouse-service, wdio-local-runner, wdio-logger, wdio-mocha-framework, wdio-repl, wdio-reporter, wdio-runner, wdio-sauce-service, wdio-shared-store-service, wdio-smoke-test-cjs-service, wdio-smoke-test-reporter, wdio-smoke-test-service, wdio-spec-reporter, wdio-static-server-service, wdio-sumologic-reporter, wdio-testingbot-service, wdio-types, wdio-utils, wdio-webdriver-mock-service, webdriver, webdriverio
  • wdio-browser-runner

:nail_care: Polish

  • wdio-browserstack-service

:memo: Documentation

Committers: 8

v9.0.7 (2024-08-21)

:bug: Bug Fix

Committers: 1

v9.0.6 (2024-08-21)

:bug: Bug Fix

  • webdriver
  • webdriver, webdriverio
  • wdio-utils
    • #13426 fix(@wdio/cli): correctly detect chrome headless shell as chrome #13390 (@BorisOsipov)

Committers: 2

v9.0.5 (2024-08-20)

:bug: Bug Fix

:nail_care: Polish

  • webdriver

:memo: Documentation

Committers: 2

v9.0.4 (2024-08-19)

:bug: Bug Fix

:house: Internal

  • wdio-browser-runner, wdio-cucumber-framework, wdio-mocha-framework, wdio-smoke-test-cjs-service, wdio-smoke-test-service, wdio-utils, webdriverio
  • Other

Committers: 3

v9.0.3 (2024-08-16)

:bug: Bug Fix

Committers: 1

v9.0.2 (2024-08-16)

:bug: Bug Fix

Committers: 2

v9.0.1 (2024-08-15)

:bug: Bug Fix

  • wdio-browser-runner, webdriverio

Committers: 1

v9.0.0 (2024-08-15)

:boom: Breaking Change

  • wdio-cli, wdio-devtools-service, wdio-lighthouse-service, wdio-utils, webdriver, webdriverio
  • wdio-allure-reporter, wdio-appium-service, wdio-browser-runner, wdio-browserstack-service, wdio-cli, wdio-concise-reporter, wdio-config, wdio-cucumber-framework, wdio-devtools-service, wdio-firefox-profile-service, wdio-jasmine-framework, wdio-json-reporter, wdio-junit-reporter, wdio-local-runner, wdio-mocha-framework, wdio-reporter, wdio-runner, wdio-sauce-service, wdio-shared-store-service, wdio-spec-reporter, wdio-testingbot-service, wdio-types, wdio-utils, wdio-webdriver-mock-service, webdriver, webdriverio
  • @wdio/protocols
  • webdriverio

:rocket: New Feature

:bug: Bug Fix

:nail_care: Polish

  • webdriver
  • wdio-cli, wdio-config, wdio-local-runner, wdio-runner, wdio-types, webdriverio

:house: Internal

Committers: 5