npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dbrans-browserstack

v0.1.2

Published

A client for working with the BrowserStack API.

Downloads

6

Readme

node-browserstack

A node.js JavaScript client for working with BrowserStack through its API.

Installation

npm install browserstack

Usage

var BrowserStack = require( "browserstack" );
var client = BrowserStack.createClient({
	username: "foo",
	password: "p455w0rd!!1"
});

client.getBrowsers(function( error, browsers ) {
	console.log( "The following browsers are available for testing" );
	console.log( browsers );
});

API

browser objects

A common pattern in the API is a "browser object" which is just a plain object with the following properties:

  • os: The operating system.
  • browser: The browser name.
  • device: The device name.
  • version: The browser or device version.

A browser object may only have one of browser or device set; which property is set will depend on os.

V1 does not support multiple operating systems. As such, there is no os version, and browser objects will always use browser.

worker objects

Worker objects are extended browser objects which contain the following additional properties:

  • id: The worker id.
  • status: A string representing the current status of the worker.
    • Possible statuses: "running", "queue".

BrowserStack.createClient( settings )

Creates a new client instance.

  • settings: A hash of settings that apply to all requests for the new client.
    • username: The username for the BrowserStack account.
    • password: The password for the BrowserStack account.
    • version (optional; default: 2): Which version of the BrowserStack API to use.

client.getBrowsers( callback )

Gets the list of available browsers.

  • callback (function( error, browsers )): A callback to invoke when the API call is complete.

client.createWorker( settings, callback )

Creates a worker.

  • settings: A hash of settings for the worker (an extended browser object).
    • os: Which OS to use for the new worker.
    • browser/device: Which browser/device to use in the new worker. Which property to use depends on the OS.
    • version: Which version of the specified browser to use.
    • url (optional): Which URL to navigate to upon creation.
    • timeout (optional): Maximum life of the worker (in seconds). Use 0 for "forever" (BrowserStack will kill the worker after 1,800 seconds).
  • callback (function( error, worker )): A callback to invoke when the API call is complete.

Note: A special value of "latest" is supported for version, which will use the latest stable version.

client.getWorker( id, callback )

Gets the status of a worker.

  • id: The id of the worker.
  • callback (function( error, worker )): A callback to invoke when the API call is complete.

client.terminateWorker( id, callback )

Terminates an active worker.

  • id: The id of the worker to terminate.
  • callback (function( error, data )): A callback to invoke when the API call is complete.
    • data: An object with a time property indicating how long the worker was alive.

client.getWorkers( callback )

Gets the status of all workers.

  • callback (function( error, workers )): A callback to invoke when the API call is complete.

client.getLatest( browser, callback )

Gets the latest version of a browser.

  • browser: Which browser to get the latest version for.
  • callback (function( error, version )): A callback to invoke when the version is determined.
    • version: The latest version of the browser.

client.getLatest( callback )

Gets the latest version of all browsers.

  • callback (function( error, versions )): A callback to invoke when the versions are determined.
    • versions: A hash of browser names and versions.

License

node-browserstack is licensed under the MIT license.