Installations
npm install @rpai/webdriver
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Min. Node Version
^16.13 || >=18
Node Version
20.15.0
NPM Version
10.7.0
Score
53.5
Supply Chain
88.8
Quality
76.7
Maintenance
100
Vulnerability
97.9
License
Releases
Contributors
Languages
TypeScript (94.46%)
JavaScript (3.3%)
EJS (1.45%)
CSS (0.68%)
Gherkin (0.07%)
Dockerfile (0.03%)
Vue (0.01%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
394
Last Day
1
Last Week
5
Last Month
37
Last Year
394
GitHub Statistics
MIT License
9,185 Stars
7,809 Commits
2,539 Forks
215 Watchers
30 Branches
621 Contributors
Updated on Feb 16, 2025
Package Meta Information
Latest Version
1.0.3
Package Id
@rpai/webdriver@1.0.3
Unpacked Size
347.11 kB
Size
65.50 kB
File Count
64
NPM Version
10.7.0
Node Version
20.15.0
Published on
Sep 27, 2024
Total Downloads
Cumulative downloads
Total Downloads
394
Last Day
0%
1
Compared to previous day
Last Week
-16.7%
5
Compared to previous week
Last Month
85%
37
Compared to previous month
Last Year
0%
394
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
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:
- WebDriver
- WebDriver Bidi
- Appium
- Chromium (additional Chromedriver specific commands)
- Selenium (additional Selenium WebDriver specific commands)
- Sauce Labs (Sauce Labs specific WebDriver extensions)
- JSONWireProtocol (depcrecated)
- Mobile JSONWireProtocol (depcrecated)
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 @wdio/protocols
package. All commands come with TypeScript support.
Install
To install this package from NPM run:
1npm i webdriver
WebDriver Example
The following example demonstrates a simple Google Search scenario:
1import WebDriver from 'webdriver';
2
3const client = await WebDriver.newSession({
4 path: '/',
5 capabilities: { browserName: 'firefox' }
6})
7
8await client.navigateTo('https://www.google.com/ncr')
9
10const searchInput = await client.findElement('css selector', '#lst-ib')
11await client.elementSendKeys(searchInput['element-6066-11e4-a52e-4f735466cecf'], 'WebDriver')
12
13const searchBtn = await client.findElement('css selector', 'input[value="Google Search"]')
14await client.elementClick(searchBtn['element-6066-11e4-a52e-4f735466cecf'])
15
16console.log(await client.getTitle()) // outputs "WebDriver - Google Search"
17
18await 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:
1import WebDriver from 'webdriver' 2 3const browser = await WebDriver.newSession({ 4 capabilities: { 5 webSocketUrl: true, 6 browserName: 'firefox' 7 } 8}) 9 10await browser.sessionSubscribe({ events: ['log.entryAdded'] }) 11 12/** 13 * returns: {"type":"console","method":"log","realm":null,"args":[{"type":"string","value":"Hello Bidi"}],"level":"info","text":"Hello Bidi","timestamp":1657282076037} 14 */ 15browser.on('log.entryAdded', (entryAdded) => console.log('received %s', entryAdded)) 16 17await browser.executeScript('console.log("Hello Bidi")', []) 18await browser.deleteSession()
Configuration
To create a WebDriver session call the newSession
method on the WebDriver
class and pass in your configurations:
1import WebDriver from 'webdriver' 2const 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: 0.0.0.0
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 custom http
/https
/http2
agent to make requests.
Type: Object
Default:
1{ 2 http: new http.Agent({ keepAlive: true }), 3 https: new https.Agent({ keepAlive: true }) 4}
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

No vulnerabilities found.
Reason
security policy file detected
Details
- Info: security policy file detected: .github/SECURITY.md:1
- Info: Found linked content: .github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/SECURITY.md:1
- Info: Found text in security policy: .github/SECURITY.md:1
Reason
30 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
binaries present in source code
Details
- Warn: binary detected: e2e/browser-runner/wasm/add.wasm:1
Reason
badge detected: Passing
Reason
Found 6/25 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/authorize.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/authorize.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/expense.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/expense.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/publish.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/publish.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/publish.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-cloud.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/test-cloud.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-component.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/test-component.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-launch.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/test-launch.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-multiremote.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/test-multiremote.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-testrunner.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/test-testrunner.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/update.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/webdriverio/webdriverio/update.yaml/main?enable=pin
- Warn: containerImage not pinned by hash: .devcontainer/Dockerfile:1: pin your Docker image by updating mcr.microsoft.com/devcontainers/javascript-node:0-18 to mcr.microsoft.com/devcontainers/javascript-node:0-18@sha256:ed57dd8755b4e75a0426bd10ab1d3a60a22bb21fc2e093801375990978c42fb5
- Warn: containerImage not pinned by hash: .gitpod/dev.dockerfile:1: pin your Docker image by updating gitpod/workspace-node to gitpod/workspace-node@sha256:ed977af45c8df79ddeeaf2f615419d7b8f5b842edcafc31d2d5abd897e72ffd9
- Warn: npmCommand not pinned by hash: .devcontainer/Dockerfile:22-26
- Warn: npmCommand not pinned by hash: .gitpod/dev.dockerfile:14-15
- Info: 17 out of 24 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 5 third-party GitHubAction dependencies pinned
- Info: 0 out of 2 containerImage dependencies pinned
- Info: 0 out of 2 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: jobLevel 'contents' permission set to 'write': .github/workflows/expense.yml:45
- Warn: jobLevel 'contents' permission set to 'write': .github/workflows/publish.yml:36
- Warn: no topLevel permission defined: .github/workflows/authorize.yml:1
- Warn: no topLevel permission defined: .github/workflows/build.yml:1
- Warn: no topLevel permission defined: .github/workflows/cr.yml:1
- Info: topLevel 'contents' permission set to 'read': .github/workflows/deploy.yml:8
- Warn: no topLevel permission defined: .github/workflows/expense.yml:1
- Warn: no topLevel permission defined: .github/workflows/labeler.yml:1
- Warn: no topLevel permission defined: .github/workflows/publish.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-cloud.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-component.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-interop.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-launch.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-multiremote.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-smoke.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-standalone.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-static.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-testrunner.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-typings.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-unit.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Warn: topLevel 'contents' permission set to 'write': .github/workflows/update.yaml:11
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 19 are checked with a SAST tool
Reason
21 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-x4c5-c7rf-jjgv
- Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q
- Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38
- Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-c76h-2ccp-4975
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
4.9
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @rpai/webdriver
@rpai/webdriverio
Next-gen browser and mobile automation test framework for Node.js
@rpai/wdio-logger
A helper utility for logging of WebdriverIO packages
@rpai/wdio-utils
A WDIO helper utility to provide several utility functions used across the project.
@rpai/wdio-types
Utility package providing type information for a variety of WebdriverIO interfaces