webdriver
A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol
Last updated 2 years ago by wdio-user .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install webdriver 
SYNC missed versions from official npm registry.

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 have an opinionated API and recommended way to use. 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 clients protocol based on assumptions of provided capabilities. You can find more details about the commands by checking out the @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 '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 './packages/webdriver/build/index.js'

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

await browser.send({
    method: 'session.subscribe',
    params: { events: ['log.entryAdded'] }
})

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

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 'webdriver'
const client = await WebDriver.newSession(options)

The following options are available:

capabilities

Defines the capabilities you want to run in your Selenium session.

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: 4444

path

Path to WebDriver endpoint or grid server.

Type: String
Default: /

queryParams

Query parameters that are propagated to the driver server.

Type: Object Default: null

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: 2

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

Type: (RequestOptions) => RequestOptions
Default: none

transformResponse

Function intercepting HTTP response objects after a WebDriver response has arrived

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

Current Tags

  • 5.0.0-alpha.14                                ...           alpha (6 years ago)
  • 7.0.0-beta.4                                ...           beta (4 years ago)
  • 8.6.8                                ...           latest (2 years ago)
  • 5.23.0                                ...           latest-5 (5 years ago)
  • 8.0.0-alpha.631                                ...           next (2 years ago)
  • 7.30.2                                ...           v7 (2 years ago)

352 Versions

  • 8.6.8                                ...           2 years ago
  • 8.6.6                                ...           2 years ago
  • 8.6.2                                ...           2 years ago
  • 8.6.1                                ...           2 years ago
  • 8.6.0                                ...           2 years ago
  • 8.5.7                                ...           2 years ago
  • 7.30.2                                ...           2 years ago
  • 8.5.6                                ...           2 years ago
  • 8.5.5                                ...           2 years ago
  • 8.5.1                                ...           2 years ago
  • 8.4.0                                ...           2 years ago
  • 8.3.11                                ...           2 years ago
  • 8.3.8                                ...           2 years ago
  • 8.3.5                                ...           2 years ago
  • 8.3.2                                ...           2 years ago
  • 8.3.1                                ...           2 years ago
  • 8.3.0                                ...           2 years ago
  • 8.2.3                                ...           2 years ago
  • 8.2.2                                ...           2 years ago
  • 8.2.0                                ...           2 years ago
  • 7.30.0                                ...           2 years ago
  • 8.1.3                                ...           2 years ago
  • 8.1.2                                ...           2 years ago
  • 8.1.0                                ...           2 years ago
  • 8.0.15                                ...           2 years ago
  • 8.0.14                                ...           2 years ago
  • 8.0.13                                ...           2 years ago
  • 8.0.11                                ...           2 years ago
  • 8.0.10                                ...           2 years ago
  • 8.0.9                                ...           2 years ago
  • 8.0.8                                ...           2 years ago
  • 8.0.7                                ...           2 years ago
  • 8.0.6                                ...           2 years ago
  • 8.0.2                                ...           2 years ago
  • 8.0.0                                ...           2 years ago
  • 8.0.0-alpha.631                                ...           2 years ago
  • 8.0.0-alpha.630                                ...           2 years ago
  • 8.0.0-alpha.629                                ...           2 years ago
  • 8.0.0-alpha.621                                ...           2 years ago
  • 8.0.0-alpha.620                                ...           2 years ago
  • 8.0.0-alpha.619                                ...           2 years ago
  • 8.0.0-alpha.607                                ...           2 years ago
  • 8.0.0-alpha.600                                ...           2 years ago
  • 8.0.0-alpha.598                                ...           2 years ago
  • 8.0.0-alpha.593                                ...           2 years ago
  • 7.27.0                                ...           2 years ago
  • 8.0.0-alpha.589                                ...           2 years ago
  • 8.0.0-alpha.577                                ...           2 years ago
  • 8.0.0-alpha.565                                ...           2 years ago
  • 8.0.0-alpha.563                                ...           2 years ago
  • 8.0.0-alpha.558                                ...           2 years ago
  • 7.26.0                                ...           2 years ago
  • 8.0.0-alpha.547                                ...           2 years ago
  • 8.0.0-alpha.537                                ...           2 years ago
  • 8.0.0-alpha.518                                ...           2 years ago
  • 8.0.0-alpha.516                                ...           2 years ago
  • 8.0.0-alpha.512                                ...           2 years ago
  • 8.0.0-alpha.508                                ...           2 years ago
  • 8.0.0-alpha.507                                ...           2 years ago
  • 8.0.0-alpha.505                                ...           2 years ago
  • 8.0.0-alpha.504                                ...           2 years ago
  • 7.20.8-alpha.504                                ...           2 years ago
  • 7.25.4                                ...           2 years ago
  • 8.0.0-alpha.412                                ...           2 years ago
  • 8.0.0-alpha.411                                ...           2 years ago
  • 7.25.1                                ...           2 years ago
  • 8.0.0-alpha.365                                ...           2 years ago
  • 7.25.0                                ...           2 years ago
  • 7.24.1                                ...           2 years ago
  • 8.0.0-alpha.331                                ...           2 years ago
  • 8.0.0-alpha.330                                ...           2 years ago
  • 8.0.0-alpha.329                                ...           2 years ago
  • 8.0.0-alpha.328                                ...           2 years ago
  • 8.0.0-alpha.327                                ...           2 years ago
  • 7.24.0                                ...           2 years ago
  • 7.23.0                                ...           2 years ago
  • 8.0.0-alpha.249                                ...           2 years ago
  • 7.22.0                                ...           2 years ago
  • 8.0.0-alpha.243                                ...           2 years ago
  • 8.0.0-alpha.240                                ...           2 years ago
  • 8.0.0-alpha.239                                ...           2 years ago
  • 7.21.0                                ...           2 years ago
  • 8.0.0-alpha.219                                ...           2 years ago
  • 8.0.0-alpha.213                                ...           2 years ago
  • 7.20.8                                ...           2 years ago
  • 7.20.7                                ...           2 years ago
  • 7.20.6                                ...           2 years ago
  • 7.20.4                                ...           2 years ago
  • 7.20.3                                ...           2 years ago
  • 7.20.2                                ...           2 years ago
  • 7.20.1                                ...           3 years ago
  • 7.20.0                                ...           3 years ago
  • 7.19.7                                ...           3 years ago
  • 7.19.5                                ...           3 years ago
  • 7.19.3                                ...           3 years ago
  • 7.19.2                                ...           3 years ago
  • 7.19.1                                ...           3 years ago
  • 7.19.0                                ...           3 years ago
  • 7.18.1                                ...           3 years ago
  • 7.18.0                                ...           3 years ago
  • 7.17.3                                ...           3 years ago
  • 7.17.0                                ...           3 years ago
  • 7.16.16                                ...           3 years ago
  • 7.16.14                                ...           3 years ago
  • 7.16.13                                ...           3 years ago
  • 7.16.11                                ...           3 years ago
  • 7.16.9                                ...           3 years ago
  • 7.16.7                                ...           3 years ago
  • 7.16.3                                ...           3 years ago
  • 7.16.1                                ...           3 years ago
  • 7.16.0                                ...           3 years ago
  • 7.14.1                                ...           3 years ago
  • 7.13.2                                ...           3 years ago
  • 7.13.1                                ...           3 years ago
  • 7.13.0                                ...           3 years ago
  • 7.12.5                                ...           3 years ago
  • 7.12.4                                ...           3 years ago
  • 7.12.3                                ...           3 years ago
  • 7.12.2                                ...           3 years ago
  • 7.12.1                                ...           3 years ago
  • 7.12.0                                ...           3 years ago
  • 7.11.0                                ...           3 years ago
  • 7.10.1                                ...           3 years ago
  • 7.10.0                                ...           3 years ago
  • 7.9.1                                ...           3 years ago
  • 7.9.0                                ...           3 years ago
  • 7.8.0                                ...           3 years ago
  • 7.7.7                                ...           3 years ago
  • 7.7.5                                ...           3 years ago
  • 7.7.4                                ...           3 years ago
  • 7.7.3                                ...           3 years ago
  • 7.7.2                                ...           4 years ago
  • 7.7.0                                ...           4 years ago
  • 7.6.0                                ...           4 years ago
  • 7.5.3                                ...           4 years ago
  • 7.5.2                                ...           4 years ago
  • 7.5.0                                ...           4 years ago
  • 7.4.6                                ...           4 years ago
  • 7.4.2                                ...           4 years ago
  • 7.4.1                                ...           4 years ago
  • 7.4.0                                ...           4 years ago
  • 7.3.1                                ...           4 years ago
  • 7.3.0                                ...           4 years ago
  • 7.2.1                                ...           4 years ago
  • 7.2.0                                ...           4 years ago
  • 7.1.1                                ...           4 years ago
  • 7.0.7                                ...           4 years ago
  • 7.0.4                                ...           4 years ago
  • 7.0.3                                ...           4 years ago
  • 7.0.2                                ...           4 years ago
  • 7.0.0                                ...           4 years ago
  • 7.0.0-beta.4                                ...           4 years ago
  • 7.0.0-beta.1                                ...           4 years ago
  • 7.0.0-beta.0                                ...           4 years ago
  • 6.12.1                                ...           4 years ago
  • 6.12.0                                ...           4 years ago
  • 6.11.0                                ...           4 years ago
  • 6.10.11                                ...           4 years ago
  • 6.10.10                                ...           4 years ago
  • 6.10.6                                ...           4 years ago
  • 6.10.4                                ...           4 years ago
  • 6.10.0                                ...           4 years ago
  • 6.9.1                                ...           4 years ago
  • 6.9.0                                ...           4 years ago
  • 6.8.2                                ...           4 years ago
  • 6.8.0                                ...           4 years ago
  • 6.7.3                                ...           4 years ago
  • 6.7.1                                ...           4 years ago
  • 6.7.0                                ...           4 years ago
  • 6.6.3                                ...           4 years ago
  • 6.6.2                                ...           4 years ago
  • 6.6.0                                ...           4 years ago
  • 6.5.0                                ...           4 years ago
  • 6.4.7                                ...           4 years ago
  • 6.4.6                                ...           4 years ago
  • 6.4.5                                ...           4 years ago
  • 6.4.2                                ...           4 years ago
  • 6.4.1                                ...           4 years ago
  • 6.4.0                                ...           4 years ago
  • 6.3.6                                ...           4 years ago
  • 6.3.5                                ...           4 years ago
  • 6.3.0                                ...           4 years ago
  • 6.2.0                                ...           4 years ago
  • 6.1.25                                ...           4 years ago
  • 6.1.17                                ...           4 years ago
  • 6.1.14                                ...           5 years ago
  • 5.23.0                                ...           5 years ago
  • 6.1.11                                ...           5 years ago
  • 6.1.8                                ...           5 years ago
  • 6.1.4                                ...           5 years ago
  • 6.1.2                                ...           5 years ago
  • 6.1.0                                ...           5 years ago
  • 6.0.18                                ...           5 years ago
  • 6.0.16                                ...           5 years ago
  • 6.0.15                                ...           5 years ago
  • 6.0.14                                ...           5 years ago
  • 6.0.13                                ...           5 years ago
  • 6.0.12                                ...           5 years ago
  • 6.0.11                                ...           5 years ago
  • 6.0.10                                ...           5 years ago
  • 6.0.8                                ...           5 years ago
  • 6.0.7                                ...           5 years ago
  • 6.0.6                                ...           5 years ago
  • 6.0.4                                ...           5 years ago
  • 6.0.1                                ...           5 years ago
  • 6.0.0                                ...           5 years ago
  • 5.22.4                                ...           5 years ago
  • 5.22.3                                ...           5 years ago
  • 6.0.0-beta.1                                ...           5 years ago
  • 5.22.1                                ...           5 years ago
  • 5.21.0                                ...           5 years ago
  • 5.19.0                                ...           5 years ago
  • 6.0.0-beta.0                                ...           5 years ago
  • 5.18.7                                ...           5 years ago
  • 5.18.6                                ...           5 years ago
  • 6.0.0-alpha.1                                ...           5 years ago
  • 5.18.4                                ...           5 years ago
  • 5.18.2                                ...           5 years ago
  • 5.18.0                                ...           5 years ago
  • 6.0.0-alpha.0                                ...           5 years ago
  • 5.17.0                                ...           5 years ago
  • 5.16.15                                ...           5 years ago
  • 5.16.13                                ...           5 years ago
  • 5.16.12                                ...           5 years ago
  • 5.16.11                                ...           5 years ago
  • 5.16.10                                ...           5 years ago
  • 5.16.7                                ...           5 years ago
  • 5.16.6                                ...           5 years ago
  • 5.16.5                                ...           5 years ago
  • 5.16.4                                ...           5 years ago
  • 5.16.3                                ...           5 years ago
  • 5.16.2                                ...           5 years ago
  • 5.16.0                                ...           5 years ago
  • 5.15.6                                ...           5 years ago
  • 5.15.4                                ...           5 years ago
  • 5.15.3                                ...           5 years ago
  • 5.15.1                                ...           5 years ago
  • 5.15.0                                ...           5 years ago
  • 5.14.4                                ...           5 years ago
  • 5.14.3                                ...           5 years ago
  • 5.14.0                                ...           5 years ago
  • 5.13.2                                ...           5 years ago
  • 5.13.1                                ...           5 years ago
  • 5.13.0                                ...           5 years ago
  • 5.13.0-alpha.0                                ...           5 years ago
  • 5.12.1                                ...           5 years ago
  • 5.12.0                                ...           5 years ago
  • 5.11.13                                ...           5 years ago
  • 5.11.12                                ...           5 years ago
  • 5.11.10                                ...           5 years ago
  • 5.11.7                                ...           5 years ago
  • 5.11.5                                ...           5 years ago
  • 5.11.0                                ...           5 years ago
  • 5.10.9                                ...           5 years ago
  • 5.10.8                                ...           5 years ago
  • 5.10.4                                ...           5 years ago
  • 5.10.0                                ...           5 years ago
  • 5.9.6                                ...           6 years ago
  • 5.9.4                                ...           6 years ago
  • 5.9.3                                ...           6 years ago
  • 5.9.1                                ...           6 years ago
  • 5.9.0                                ...           6 years ago
  • 5.8.6                                ...           6 years ago
  • 5.8.5                                ...           6 years ago
  • 5.8.3                                ...           6 years ago
  • 5.8.2                                ...           6 years ago
  • 5.8.1                                ...           6 years ago
  • 5.8.0                                ...           6 years ago
  • 5.7.15                                ...           6 years ago
  • 5.7.14                                ...           6 years ago
  • 5.7.13                                ...           6 years ago
  • 5.7.12                                ...           6 years ago
  • 5.7.9                                ...           6 years ago
  • 5.7.8                                ...           6 years ago
  • 5.7.6                                ...           6 years ago
  • 5.7.5                                ...           6 years ago
  • 5.7.3                                ...           6 years ago
  • 5.7.2                                ...           6 years ago
  • 5.7.1                                ...           6 years ago
  • 5.7.0                                ...           6 years ago
  • 5.6.5                                ...           6 years ago
  • 5.6.4                                ...           6 years ago
  • 5.6.3                                ...           6 years ago
  • 5.6.2                                ...           6 years ago
  • 5.6.0                                ...           6 years ago
  • 5.5.0                                ...           6 years ago
  • 5.4.20                                ...           6 years ago
  • 5.4.18                                ...           6 years ago
  • 5.4.15                                ...           6 years ago
  • 5.4.14                                ...           6 years ago
  • 5.4.13                                ...           6 years ago
  • 5.4.12                                ...           6 years ago
  • 5.4.11                                ...           6 years ago
  • 5.4.10                                ...           6 years ago
  • 5.4.9                                ...           6 years ago
  • 5.4.8                                ...           6 years ago
  • 5.4.7                                ...           6 years ago
  • 5.4.6                                ...           6 years ago
  • 5.4.3                                ...           6 years ago
  • 5.4.2                                ...           6 years ago
  • 5.4.1                                ...           6 years ago
  • 5.4.0                                ...           6 years ago
  • 5.3.5                                ...           6 years ago
  • 5.3.4                                ...           6 years ago
  • 5.3.3                                ...           6 years ago
  • 5.3.2                                ...           6 years ago
  • 5.3.1                                ...           6 years ago
  • 5.3.0                                ...           6 years ago
  • 5.2.8                                ...           6 years ago
  • 5.2.7                                ...           6 years ago
  • 5.2.5                                ...           6 years ago
  • 5.2.4                                ...           6 years ago
  • 5.2.3                                ...           6 years ago
  • 5.2.2                                ...           6 years ago
  • 5.2.1                                ...           6 years ago
  • 5.2.0                                ...           6 years ago
  • 5.1.1                                ...           6 years ago
  • 5.1.0                                ...           6 years ago
  • 5.0.3                                ...           6 years ago
  • 5.0.0                                ...           6 years ago
  • 5.0.0-beta.16                                ...           6 years ago
  • 5.0.0-beta.15                                ...           6 years ago
  • 5.0.0-beta.14                                ...           6 years ago
  • 5.0.0-beta.13                                ...           6 years ago
  • 5.0.0-beta.12                                ...           6 years ago
  • 5.0.0-beta.10                                ...           6 years ago
  • 5.0.0-beta.9                                ...           6 years ago
  • 5.0.0-beta.8                                ...           6 years ago
  • 5.0.0-beta.7                                ...           6 years ago
  • 5.0.0-beta.6                                ...           6 years ago
  • 5.0.0-beta.5                                ...           6 years ago
  • 5.0.0-beta.3                                ...           6 years ago
  • 5.0.0-beta.2                                ...           6 years ago
  • 5.0.0-beta.1                                ...           6 years ago
  • 5.0.0-beta.0 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.14 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.13 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.12 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.11 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.10 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.9 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.7 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.6 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.5 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.4 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.3 [deprecated]           ...           6 years ago
  • 5.0.0-alpha.2 [deprecated]           ...           6 years ago
  • 0.0.4 [deprecated]           ...           7 years ago
  • 0.0.3 [deprecated]           ...           7 years ago
  • 0.0.2 [deprecated]           ...           7 years ago
  • 5.0.0-rc1 [deprecated]           ...           7 years ago
  • 0.0.1 [deprecated]           ...           13 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (11)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |