Detect the browser versions available on your system and launch them in an isolated profile for automated testing purposes.
It's a fork of substack/browser-launcher repository which seems to be no longer maintained.
Differences from browser-launcher
- contains fixes and pull requests for unresolved issues reported in original repository
launcher.browsersis an array of local browsers only, not an object as it was before
launchcallback returns an
Instanceinstead of a child process, see API section for more details
- uses win-detect-browsers for browser detection on Windows
- more browsers supported
The goal for this module is to support all major browsers on every desktop platform.
At the moment,
browser-launcher2 supports following browsers on Windows, Unix and OS X:
- IE (Windows only)
- PhantomJS (Linux and OS X only)
npm install browser-launcher3
var launcher = ;;
$ node example/launch.js Instance started with PID: 12345 Instance stopped with exit code: 0
var launcher = ;launcher;
$ node example/detect.jsAvailable browsers:[
var launcher = ;
Detect available browsers and pass
launch function to the callback.
configPath- path to a browser configuration file (Optional)
callback(err, launch)- function called with
launchfunction and errors (if any)
launch(uri, options, callback)
Open given URI in a browser and return an instance of it.
uri- URI to open in a newly started browser
options- configuration options or name of a browser to launch
options.browser- name of a browser to launch
options.version- version of a browser to launch, if none was given, the highest available version will be launched
options.options- additional command line options
options.proxy- URI of the proxy server
options.noProxy- set proxy routes to skip over
options.headless- run a browser in a headless mode (only if Xvfb available)
callback(err, instance)- function fired when started a browser
instanceor an error occurred
This property contains an array of all known and available browsers.
Browser instance object.
command- command used to start the instance
args- array of command line arguments used while starting the instance
image- instance's image name
processName- instance's process name
process- reference to instance's process started with Node's
pid- instance's process PID
stdout- instance's process STDOUT stream
stderr- instance's process STDERR stream
stop- fired when instance stops
stop(callback)- stop the instance and fire the callback once stopped
Detects all browsers available.
callback(available)- function called with array of all recognized browsers
Each browser contains following properties:
name- name of a browser
version- browser's version
type- type of a browser i.e. browser's family
command- command used to launch a browser
Updates the browsers cache file (
~/.config/browser-launcher/config.json is no
configDir was given) and creates new profiles for found browsers.
configDir- path to a directory containing configuration file Optional
callback(err, browsers)- function called with found browsers and errors (if any)
- Firefox: it's not possible to launch multiple instances of Firefox at once
- IE8: after several starts and stops, if you manually open IE it willcome up with a pop-up asking if we want to restore tabs (#21)
- Chrome @ OSX: it's not possible to launch multiple instances of Chrome at once