# @gemini-testing/webdriver

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

Latest version **7.27.0** (published 2023-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gemini-testing/webdriver
pnpm add @gemini-testing/webdriver
yarn add @gemini-testing/webdriver
bun add @gemini-testing/webdriver
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 7.27.0 |
| Published | 2023-04-13 |
| First published | 2023-04-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 9 |
| Unpacked size | 102.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9884 |
| Author | Christian Bromann |
| Maintainers | oldskytree, xrsd, kuznetsovroman, dudagod, j0tunn, sipayrt, rostik404, gavryushin, miripiruni, mcheshkov |
| Keywords | webdriver |

## Links

- npm: https://www.npmjs.com/package/@gemini-testing/webdriver
- Repository: https://github.com/webdriverio/webdriverio
- Homepage: https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver
- Issues: https://github.com/webdriverio/webdriverio/issues
- npm.io page: https://npm.io/package/@gemini-testing/webdriver

## Dependencies (9)

- [ky](https://npm.io/package/ky.md) 0.30.0
- [got](https://npm.io/package/got.md) ^11.0.2
- [@types/node](https://npm.io/package/@types/node.md) ^18.0.0
- [@wdio/types](https://npm.io/package/@wdio/types.md) 7.26.0
- [@wdio/utils](https://npm.io/package/@wdio/utils.md) 7.26.0
- [@wdio/config](https://npm.io/package/@wdio/config.md) 7.26.0
- [@wdio/logger](https://npm.io/package/@wdio/logger.md) 7.26.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.1
- [@wdio/protocols](https://npm.io/package/@wdio/protocols.md) 7.27.0

## Recent versions

- 7.27.0 (latest) — 2023-04-13

## README

WebDriver
=========

> A lightweight, non-opinionated implementation of the [WebDriver specification](https://w3c.github.io/webdriver/webdriver-spec.html) including mobile commands supported by [Appium](http://appium.io/)

There are [tons](https://github.com/christian-bromann/awesome-selenium#javascript) 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](https://w3c.github.io/webdriver/webdriver-spec.html) and doesn't come with any extra or higher level abstraction. It is lightweight and comes with support for the [WebDriver specification](https://w3c.github.io/webdriver/webdriver-spec.html) and Appium's [Mobile JSONWire Protocol](https://github.com/appium/appium-base-driver/blob/master/docs/mjsonwp/protocol-methods.md).

The package supports the following protocols:

- [WebDriver](https://w3c.github.io/webdriver/)
- [Appium](http://appium.io/)
- [Chromium](http://chromedriver.chromium.org/) (additional Chromedriver specific commands)
- [Selenium](https://www.selenium.dev/) (additional Selenium WebDriver specific commands)
- [Sauce Labs](https://saucelabs.com/) (Sauce Labs specific WebDriver extensions)
- [JSONWireProtocol](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol) (depcrecated)
- [Mobile JSONWireProtocol](https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md) (depcrecated)

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`](https://www.npmjs.com/package/@wdio/protocols) package. All commands come with TypeScript support.

## Install

To install this package from NPM run:

```sh
npm i webdriver
```

## Example

The following example demonstrates a simple Google Search scenario:

```js
import WebDriver from 'webdriver';

(async () => {
    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()
})()
```

# Configuration

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

```js
import WebDriver from 'webdriver'
const client = await WebDriver.newSession(options)
```

The following options are available:

### capabilities
Defines the [capabilities](https://w3c.github.io/webdriver/webdriver-spec.html#capabilities) you want to run in your Selenium session.

Type: `Object`<br />
Required: `true`

### logLevel
Level of logging verbosity.

Type: `String`<br />
Default: *info*<br />
Options: *trace* | *debug* | *info* | *warn* | *error* | *silent*

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

Type: `String`<br />
Default: *http*
Options: *http* | *https*

### hostname
Host of your WebDriver server.

Type: `String`<br />
Default: *localhost*

### port
Port your WebDriver server is on.

Type: `Number`<br />
Default: *4444*

### path
Path to WebDriver endpoint or grid server.

Type: `String`<br />
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`<br />
Default: *120000*

### connectionRetryCount
Count of request retries to the Selenium server.

Type: `Number`<br />
Default: *2*

### agent

Allows you to use a custom` http`/`https`/`http2` [agent](https://www.npmjs.com/package/got#agent) to make requests.

Type: `Object`<br />
Default:

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

### transformRequest
Function intercepting [HTTP request options](https://github.com/sindresorhus/got#options) before a WebDriver request is made

Type: `(RequestOptions) => RequestOptions`<br />
Default: *none*

### transformResponse
Function intercepting HTTP response objects after a WebDriver response has arrived

Type: `(Response, RequestOptions) => Response`<br />
Default: *none*

---
_Source: https://npm.io/package/@gemini-testing/webdriver · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
