Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserstack-api

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserstack-api

BrowserStack REST API wrapper

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

NPM   Build Status

browserstack-api

BrowserStack REST API Wrapper

(C) Pradeep Mishra pradeep23oct@gmail.com

A JavaScript REST wrapper for BrowserStack service for node.js (0.6.x and up). Hides most of the complexity of creating, maintaining BrowserStack workers and sessions.

Features

  • Currently Work on servers (NodeJS)
  • Simple service wrapper that allows you to easily put together All BrowserStack REST API libraries
  • Easy create Workers, Sessions
  • Automatic User credential injection on all REST calls
  • Take Session screenshot.
  • Model binding for each BrowserStack server response

Example usage

var BS = require('browserstack-api');

// instantiate browserstack-api with userName and key
var BrowserStack = new BS('userName', 'myKey');

// an alternate method to set username and key after creating an instance of browserstack-api

var BrowserStack = new BS;
BrowserStack.setUser('userName');
BrowserStack.setKey('myKey');


// get all supported browsers list
//{all : true, flat : true} optional parameters
BrowserStack.getBrowsers({all : true, flat : true}).then(function(reponseModel){
    console.log(responseModel.toJSON());
}).fail(function(error){

});

// get status of an account
BrowserStack.getStatus().then(function(reponseModel){
    console.log(responseModel.toJSON());
}).fail(function(error){

});

// get all workers created in account
BrowserStack.getAllWorkers().then(function(reponseModel){
    console.log(responseModel.toJSON());
}).fail(function(error){

});

// methods available in BrowserStack instance
getEndPoint(String, nthString);
setKey(String); //'myKey'
setUser(String); // 'username'
setCredentials(Object); //{user : 'username', key : 'myKey}
setAPIVersion(Number); // 3
getBrowsers();
getStatus();
getAllWorkers();


// Worker Instance
// Worker class extend DataModel or responseModel
var worker = new BrowserStack.Worker;
worker.setOS('windows')
.setOSVersion(7)
.setBrowser('chrome')
.setBrowserVersion('20.0')
.setURL('http://google.com'); 
// create new worker on browserStack
worker.create().then(function(responseModel){
	console.log(responseModel.toJSON());
}).fail(function(err){

});

// get status of worker
worker.getStatus().then(function(responseModel){
    console.log(responseModel.toJSON());
}).fail(function(err){

});

// for taking screenshot of worker
worker.takeScreenShot().then(function(responseModel){
    console.log(responseModel.toJSON());
}).fail(function(err){

});

// for destroying worker
worker.destroy().then(function(responseModel){
    console.log(responseModel.toJSON());
}).fail(function(err){

});

// methods available in Worker instance
setOS(String); //'windows'
setOSVersion(String); // '7'
setBrowser(String); // 'chrome'
setDevice(String); //'ios'
setBrowserVersion(String); //'20.0'
setURL(String); //http://in.linkedin.com/in/ipradeepmishra/
setName(String); // 'pradeep'
setBuild(String); 
setProject(String);
setTimeout(Number); // 30
create();
destroy();
getStatus();
takeScreenShot();

// DataModel or responseModel class
// methods available
get(String); // name
set(String, String) // name, value
has(String); // name
where(String, String) // key, value
toJSON(); // return JSON representation of model




npm install browserstack-api --save

Keywords

FAQs

Package last updated on 23 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc