# @wdio/browserstack-service

> WebdriverIO service for better Browserstack integration

Latest version **9.36.1** (published 2026-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wdio/browserstack-service
pnpm add @wdio/browserstack-service
yarn add @wdio/browserstack-service
bun add @wdio/browserstack-service
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 9.36.1 |
| Published | 2026-09-15 |
| First published | 2018-12-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18.20.0 |
| Dependencies | 21 |
| Unpacked size | 3.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | BrowserStack |
| Maintainers | christian-bromann, wdio-user, wswebcreation-nl |
| Keywords | webdriverio, wdio, browserstack, wdio-service |

## Links

- npm: https://www.npmjs.com/package/@wdio/browserstack-service
- Repository: https://github.com/browserstack/wdio-browserstack-service
- Issues: https://github.com/browserstack/wdio-browserstack-service/issues
- npm.io page: https://npm.io/package/@wdio/browserstack-service

## Dependencies (21)

- [tar](https://npm.io/package/tar.md) ^7.5.11
- [glob](https://npm.io/package/glob.md) ^11.0.0
- [uuid](https://npm.io/package/uuid.md) ^11.1.0
- [chalk](https://npm.io/package/chalk.md) ^5.3.0
- [yauzl](https://npm.io/package/yauzl.md) ^3.4.0
- [undici](https://npm.io/package/undici.md) ^6.24.0
- [csv-writer](https://npm.io/package/csv-writer.md) ^1.6.0
- [@wdio/types](https://npm.io/package/@wdio/types.md) ^9.0.0
- [webdriverio](https://npm.io/package/webdriverio.md) ^9.0.0
- [@wdio/logger](https://npm.io/package/@wdio/logger.md) ^9.0.0
- [@grpc/grpc-js](https://npm.io/package/@grpc/grpc-js.md) ~1.13.5
- [git-repo-info](https://npm.io/package/git-repo-info.md) ^2.1.1
- [@wdio/reporter](https://npm.io/package/@wdio/reporter.md) ^9.0.0
- [gitconfiglocal](https://npm.io/package/gitconfiglocal.md) ^2.1.0
- [@percy/appium-app](https://npm.io/package/@percy/appium-app.md) ^2.0.9
- [winston-transport](https://npm.io/package/winston-transport.md) ^4.5.0
- [@bufbuild/protobuf](https://npm.io/package/@bufbuild/protobuf.md) ^2.5.2
- [browserstack-local](https://npm.io/package/browserstack-local.md) ^1.5.1
- [@types/gitconfiglocal](https://npm.io/package/@types/gitconfiglocal.md) ^2.0.1
- [@browserstack/ai-sdk-node](https://npm.io/package/@browserstack/ai-sdk-node.md) 1.5.17
- [@percy/selenium-webdriver](https://npm.io/package/@percy/selenium-webdriver.md) ^2.2.2

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 9.36.1 (latest) — 2026-09-15
- 0.0.0-canary-20260722132416 (canary) — 2026-07-22
- 8.48.3 (v8) — 2026-07-01
- 7.40.0 (v7) — 2024-12-18
- 9.0.0-alpha.426 (next) — 2024-08-05
- 9.0.0-alpha.0 (v9) — 2024-03-12
- 7.0.0-beta.4 (beta) — 2021-02-09
- 9.36.0 — 2026-09-10
- 8.51.0 — 2026-09-10
- 9.35.3 — 2026-09-09
- 9.35.2 — 2026-09-04
- 9.35.1 — 2026-08-27
- 9.35.0 — 2026-08-19
- 9.34.1 — 2026-08-18
- 9.34.0 — 2026-08-17
- … 554 more at https://npm.io/package/@wdio/browserstack-service/versions

## README

WebdriverIO BrowserStack Service
==========

> A WebdriverIO service that manages local tunnel and job metadata for BrowserStack users.

## Installation


The easiest way is to keep `@wdio/browserstack-service` as a devDependency in your `package.json`, via:

```sh
npm install @wdio/browserstack-service --save-dev
```

Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)


## Configuration

WebdriverIO has BrowserStack support out of the box. You should set `user` and `key` in your `wdio.conf.js` file. This service plugin provides support for [BrowserStack Tunnel](https://www.browserstack.com/docs/automate/selenium/getting-started/nodejs/local-testing). Set `browserstackLocal: true` also to activate this feature.
Reporting of session status on BrowserStack will respect `strict` setting of Cucumber options.

```js
// wdio.conf.js
export const config = {
    // ...
    user: process.env.BROWSERSTACK_USERNAME,
    key: process.env.BROWSERSTACK_ACCESS_KEY,
    services: [
        ['browserstack', {
            testReporting: true,
            testReportingOptions: {
                projectName: "Your project name goes here",
                buildName: "The static build job name goes here e.g. Nightly regression"
            },
            browserstackLocal: true
        }]
    ],
    // ...
};
```

## Options

In order to authorize to the BrowserStack service your config needs to contain a [`user`](https://webdriver.io/docs/options#user) and [`key`](https://webdriver.io/docs/options#key) option.

### testReporting

Test Observability is an advanced test reporting tool that gives insights to improve your automation tests and helps you debug faster. It’s enabled by default by setting the `testObservability`​ flag as `true` for all users of browserstack-service. You can disable this by setting the `testObservability`​ flag to `false`.

Once your tests finish running, you can visit [Test Reporting and Analytics](https://automation.browserstack.com/) to debug your builds with additional insights like Unique Error Analysis, Automatic Flaky Test Detection, and more.

You can use Test Observability even if you don’t run your tests on the BrowserStack infrastructure. Even if you run your tests on a CI, a local machine, or even on other cloud service providers, Test Observability can still generate intelligent test reports and advanced analytics on your tests.

If you want to use Test Reporting and Analytics without running your tests on BrowserStack infrastructure, you can set your config as follows:


```js
// wdio.conf.js
export const config = {
    // ...
    services: [
        ['browserstack', {
            testReporting: true,
            testReportingOptions: {
                user: process.env.BROWSERSTACK_USERNAME,
                key: process.env.BROWSERSTACK_ACCESS_KEY,
                projectName: "Your project name goes here",
                buildName: "The static build job name goes here e.g. Nightly regression"
            }
        }]
    ],
    // ...
};
```

You can explore all the features of Test Reporting and Analytics in [this sandbox](https://automation.browserstack.com/) or read more about it [here](https://www.browserstack.com/docs/test-reporting-and-analytics/overview/what-is-test-observability).

#### Reporting of tests skipped by `bail`

With `mochaOpts: { bail: true }`, Mocha halts a spec on its first failure and the remaining tests in that file never run. Those tests are now reported with the status `skipped`, so the report accounts for every test in the spec rather than silently omitting them. Tests in sibling `describe` blocks in the same file are covered too.

Requires `mocha` as the framework and Test Reporting enabled.

Note that WebdriverIO's own top-level `bail` option is a different setting: it counts failed *spec files* and stops scheduling further ones, rather than stopping tests within a spec. Tests in spec files that never start are not currently reported.

### browserstackLocal
Set this to true to enable routing connections from BrowserStack cloud through your computer.

Type: `Boolean`<br />
Default: `false`

### forcedStop
Set this to true to kill the BrowserStack Local process on complete, without waiting for the BrowserStack Local stop callback to be called. This is experimental and should not be used by all. Mostly necessary as a workaround for [this issue](https://github.com/browserstack/browserstack-local-nodejs/issues/41).

Type: `Boolean`<br />
Default: `false`

### app

[Appium](https://appium.io/) set this with the app file path available locally on your machine to use the app as [application under test](https://www.browserstack.com/docs/app-automate/appium/set-up-tests/specify-app) for Appium sessions.

Type: `String` or `JsonObject`<br />
Default: `undefined`

List of available app values:

#### path
Use locally available app file path as an application under test for Appium.

```js
services: [
  ['browserstack', {
    app: '/path/to/local/app.apk'
    // OR
    app: {
      path: '/path/to/local/app.apk'
    }
  }]
]
```

Pass custom_id while the app upload.

```js
services: [
  ['browserstack', {
    app: {
      path: '/path/to/local/app.apk',
      custom_id: 'custom_id'
    }
  }]
]
```

#### id
Use the app URL returned after uploading the app to BrowserStack.

```js
services: [
  ['browserstack', {
    app: 'bs://<app-id>'
    // OR
    app: {
      id: 'bs://<app-id>'
    }
  }]
]
```

#### custom_id

use custom_id of already uploaded apps

```js
services: [
  ['browserstack', {
    app: 'custom_id'
    // OR
    app: {
      custom_id: 'custom_id'
    }
  }]
]
```

#### shareable_id

use shareable_id of already uploaded apps

```js
services: [
  ['browserstack', {
    app: 'username/custom_id'
    // OR
    app: {
      shareable_id: 'username/custom_id'
    }
  }]
]
```

### preferScenarioName

Cucumber only. Set the BrowserStack Automate session name to the Scenario name if only a single Scenario ran.
Useful when running in parallel with [wdio-cucumber-parallel-execution](https://github.com/SimitTomar/wdio-cucumber-parallel-execution).

Type: `Boolean`<br />
Default: `false`

### sessionNameFormat

Customize the BrowserStack Automate session name format.

Type: `Function`<br />
Default (Cucumber/Jasmine): `(config, capabilities, suiteTitle) => suiteTitle`<br />
Default (Mocha): `(config, capabilities, suiteTitle, testTitle) => suiteTitle + ' - ' + testTitle`

### sessionNameOmitTestTitle

Mocha only. Do not append the test title to the BrowserStack Automate session name.

Type: `Boolean`<br />
Default: `false`

### sessionNamePrependTopLevelSuiteTitle

Mocha only. Prepend the top level suite title to the BrowserStack Automate session name.

Type: `Boolean`<br />
Default: `false`

### setSessionName

Automatically set the BrowserStack Automate session name.

Type: `Boolean`<br />
Default: `true`

### setSessionStatus

Automatically set the BrowserStack Automate session status (passed/failed).

Type: `Boolean`<br />
Default: `true`

### buildIdentifier

**buildIdentifier** is a unique id to differentiate every execution that gets appended to buildName. Choose your buildIdentifier format from the available expressions:
* `BUILD_NUMBER`: Generates an incremental counter with every execution
* `DATE_TIME`: Generates a Timestamp with every execution. Eg. 05-Nov-19:30

```js
services: [
  ['browserstack', {
    buildIdentifier: '#${BUILD_NUMBER}'
  }]
]
```
Build Identifier supports usage of either or both expressions along with any other characters enabling custom formatting options.

### opts

BrowserStack Local options.

Type: `Object`<br />
Default: `{}`

List of available local testing modifiers to be passed as opts:

#### Local Identifier

If doing simultaneous multiple local testing connections, set this uniquely for different processes -

```js
opts = { localIdentifier: "randomstring" };
```

#### Verbose Logging

To enable verbose logging -

```js
opts = { verbose: "true" };
```

Note - Possible values for 'verbose' modifier are '1', '2', '3' and 'true'

#### Force Local

To route all traffic via local(your) machine -

```js
opts = { forceLocal: "true" };
```

#### Folder Testing

To test local folder rather internal server, provide path to folder as value of this option -

```js
opts = { f: "/my/awesome/folder" };
```

#### Force Start

To kill other running BrowserStack Local instances -

```js
opts = { force: "true" };
```

#### Only Automate

To disable local testing for Live and Screenshots, and enable only Automate -

```js
opts = { onlyAutomate: "true" };
```

#### Proxy

To use a proxy for local testing -

- proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
- proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used
- proxyUser: Username for connecting to proxy (Basic Auth Only)
- proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified

```js
opts = {
  proxyHost: "127.0.0.1",
  proxyPort: "8000",
  proxyUser: "user",
  proxyPass: "password",
};
```

#### Local Proxy

To use local proxy in local testing -

- localProxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
- localProxyPort: Port for the proxy, defaults to 8081 when -localProxyHost is used
- localProxyUser: Username for connecting to proxy (Basic Auth Only)
- localProxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified

```js
opts = {
  localProxyHost: "127.0.0.1",
  localProxyPort: "8000",
  localProxyUser: "user",
  localProxyPass: "password",
};
```

#### PAC (Proxy Auto-Configuration)

To use PAC (Proxy Auto-Configuration) in local testing -

- pac-file: PAC (Proxy Auto-Configuration) file’s absolute path

```js
opts = { "pac-file": "<pac_file_abs_path>" };
```

#### Binary Path

By default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument.
Path to specify local Binary path -

```js
opts = { binarypath: "/path/to/binary" };
```

#### Logfile

To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory.
To specify the path to file where the logs will be saved -

```js
opts = { verbose: "true", logFile: "./local.log" };
```
For a detailed list of BrowserStack WebdriverIO services, see the BrowserStack documentation for [App Automate](https://www.browserstack.com/docs/app-automate/appium/wdio-browserstack-capabilities)(app testing) and [Automate](https://www.browserstack.com/docs/automate/selenium/wdio-browserstack-capabilities) (web testing).
----

For more information on WebdriverIO see the [homepage](https://webdriver.io).

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