You can launch browsers! From NodeJS! Local ones! Remote ones! Browserstack ones!
You can launch browsers! With NodeJS!
The general API for any launcher (
<type>) looks like this:
var launch = require'launchpad';launch<type>configurationlauncherbrowsers// -> List of available browsers with version;launcherurl configurationinstance // -> A browser instanceinstanceid // -> unique instance idinstancestopcallback // -> Stop the instanceinstancestatuscallback // -> Get status information about the instance;launcher<browsername>url// Same as above;;
Local launchers look up all currently installed browsers (unless limited by LAUNCHPAD_BROWSERS - see below for details) and allow you to start new browser processes.
// Launch a local browserlaunchlocallauncherbrowsers// -> List of all browsers found locally with version;localfirefox''// An instance is an event emitterinstanceon'stop'console.log'Terminated local firefox';;;;
By default Launchpad looks up all installed browsers. To speed-up this process you can define the following env variables:
LAUNCHPAD_BROWSERS- comma delimited list of browsers you want to use, e.g.
LAUNCHPAD_BROWSERS=chrome,firefox,opera. Other browsers will not be detected even if they are installed.
LAUNCHPAD_<browser>- specifies where given browser is installed so that Launchpad does not need to look for it, e.g.
The following browser names are recognized:
Not all platforms support all browsers - see platform for details.
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:
launchbrowserstackusername : 'user'password : 'password'launcherbrowsers// -> List of all Browserstack browsers;browserstackie''// Shut the instance down after 5 secondssetTimeoutinstancestopiferrconsole.logerr;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:
launchserverusername : 'launcher'password : 'testing'listen8080console.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:
launchremotehost : 'ie7machine'username : 'launcher'password : 'testing'launcherbrowsers// -> List of all browsers found on ie7machine;api''browser : 'safari'version : 'latest';;
LAUNCHPAD_<browser>env vars support (#52)
binPathfor detected browsers (#31)