launchpad

You can launch browsers! From NodeJS! Local ones! Remote ones! Browserstack ones!

Launchpad

Touched

You can launch browsers! With NodeJS!

  • Local browsers for MacOS, Windows and Linux (like) operating systems
  • BrowserStack browsers using the BrowserStack API
  • Remote browsers using the launchpad server

The general API for any launcher (<type>) looks like this:

var launch = require('launchpad');
launch.<type>(configuration, function(errorlauncher) {
  launcher.browsers(function(errorbrowsers) {
    // -> List of available browsers with version 
  });
 
  launcher(url, configuration, function(errorinstance) {
    instance // -> A browser instance 
    instance.id // -> unique instance id 
    instance.stop(callback) // -> Stop the instance 
    instance.status(callback) // -> Get status information about the instance 
  });
 
  launcher.<browsername>(url, function(errorinstance) {
    // Same as above 
  });
});

Local launchers look up all currently installed browsers and allow you to start new browser processes.

// Launch a local browser 
launch.local(function(errlocal) {
  launcher.browsers(function(errorbrowsers) {
    // -> List of all browsers found locally with version 
  });
  
  local.firefox('http://url', function(errinstance) {
    // An instance is an event emitter 
    instance.on('stop', function() {
      console.log('Terminated local firefox');
    });
  });
});

BrowserStack is a great cross-browser testing tool and offers API access to any account that is on a monthly plan. Launchpad allows you to start BrowserStack workers through its API like this:

launch.browserstack({
    username : 'user',
    password : 'password'
  },
  function(errbrowserstack) {
    launcher.browsers(function(errorbrowsers) {
      // -> List of all Browserstack browsers 
    });
    
    browserstack.ie('http://url', function(errinstance) {
      // Shut the instance down after 5 seconds 
      setTimeout(function() {
        instance.stop(function (err) {
          if(err) {
            console.log(err);
          }
          console.log('Browser instance has stopped');
        });
      }, 5000);
  });
});

Behind the scenes we have the node-browserstack module do all the work (API calls) for us.

Launchpad also allows you to start browsers on other systems that are running the Launchpad server.

The launchpad server is a simple implementation of the BrowserStack API (Version 1) which provides a RESTful interface to start and stop browsers. You can set up a Launchpad server like this:

launch.server({
  username : 'launcher',
  password : 'testing'
}).listen(8080, function () {
  console.log('Listeining...');
});

Because the Launchpad server is compatible with the BrowserStack API (Version 1), you could basically use any BrowserStack API client, connect to the server and start browsers.

The included remote launcher does exactly that by wrapping BrowserStack launcher and pointing it to the given host:

launch.remote({
  host : 'ie7machine',
  username : 'launcher',
  password : 'testing'
}, function(errapi) {
  launcher.browsers(function(errorbrowsers) {
    // -> List of all browsers found on ie7machine 
  });
  
  api('http://github.com', {
    browser : 'safari',
    version : 'latest'
  }, function(errinstance) {
  });
});

0.4.0

  • Output PhantomJS errors and console.logs (#35)
  • Node Webkit support for MacOS and Windows (#30, #34)
  • Allow browsers to start multiple times even if they are already running (#33)
  • Fix Windows path and add JSHint (#32)
  • Expose path and binPath for detected browsers (#31)

0.3.0

  • Major internal refactoring (#25)