BrowserStack Node.js Client

1.6.1 · abandoned · verified Wed Apr 22

This client provides a JavaScript interface for integrating Node.js applications with the BrowserStack platform. It offers programmatic access to various BrowserStack APIs, including the general REST API, the Automate API for WebDriver-based testing, the App Automate API for mobile application testing, and the Screenshots API for generating cross-browser screenshots. Developers can use it to manage virtual browsers, define testing workers, administer projects and builds, and query session information directly from their Node.js environment. As of April 2026, the package's current stable version is 1.6.1, last updated in February 2019. This indicates the project is effectively abandoned, lacking any ongoing maintenance, feature development, or security updates. Its primary differentiator was providing a unified Node.js client across multiple BrowserStack services at the time of its last release. However, due to its outdated nature, users are strongly advised to seek more recent and officially maintained BrowserStack SDKs or alternatives for robust and secure integrations. It exclusively supports CommonJS module loading.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize clients for BrowserStack's REST and Automate APIs and fetch available browsers using a CommonJS setup. It highlights credential usage and basic API calls.

const BrowserStack = require('browserstack');

// IMPORTANT: Replace with your actual BrowserStack credentials or environment variables
const browserStackCredentials = {
  username: process.env.BROWSERSTACK_USERNAME ?? 'YOUR_USERNAME',
  password: process.env.BROWSERSTACK_ACCESS_KEY ?? 'YOUR_ACCESS_KEY'
};

if (browserStackCredentials.username === 'YOUR_USERNAME' || browserStackCredentials.password === 'YOUR_ACCESS_KEY') {
  console.warn('WARNING: Please set BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables, or replace placeholders.');
}

// REST API Client
const client = BrowserStack.createClient(browserStackCredentials);

client.getBrowsers(function(error, browsers) {
  if (error) {
    console.error('Error fetching browsers from REST API:', error);
    return;
  }
  console.log('Available browsers for REST API testing (first 5):');
  console.log(browsers.slice(0, 5));
});

// Automate API Client
const automateClient = BrowserStack.createAutomateClient(browserStackCredentials);

automateClient.getBrowsers(function(error, browsers) {
  if (error) {
    console.error('Error fetching browsers from Automate API:', error);
    return;
  }
  console.log('Available browsers for Automate API testing (first 5):');
  console.log(browsers.slice(0, 5));
});

view raw JSON →