包详细信息

launchpad

bitovi7.3k0.8.1

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

browsers, launcher, chrome, ie

自述文件

Launchpad

Greenkeeper badge Build Status

You can launch browsers! With NodeJS!

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

API

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

var launch = require('launchpad');
launch.<type>(configuration, function(error, launcher) {
  launcher.browsers(function(error, browsers) {
    // -> List of available browsers with version
  });

  launcher(url, configuration, function(error, instance) {
    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(error, instance) {
    // Same as above
  });
});

Local launchers

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 browser
launch.local(function(err, local) {
  local.browsers(function(error, browsers) {
    // -> List of all browsers found locally with version
  });

  local.firefox('http://url', function(err, instance) {
    // An instance is an event emitter
    instance.on('stop', function() {
      console.log('Terminated local firefox');
    });
  });
});

Environment variables impacting local browsers detection

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. LAUNCHPAD_CHROME=/usr/bin/chromium

The following browser names are recognized: chrome, firefox, safari, ie, edge, opera, canary, aurora, electron, phantom, nodeWebKit. Not all platforms support all browsers - see platform for details.

Browserstack

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(err, browserstack) {
    browserstack.browsers(function(error, browsers) {
      // -> List of all Browserstack browsers
    });

    browserstack.ie('http://url', function(err, instance) {
      // 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.

更新日志

Change Log

v0.6.0 (2017-04-27)

Full Changelog

Closed issues:

  • add "edge" to readme #73
  • restify update to 5.x branch #72
  • Firefox hangs when attempting to close. #71
  • Splitting into smaller libraries? #57
  • Add BrowserSync support #27
  • Add command line #5

Merged pull requests:

0.5.4 (2016-09-14)

Full Changelog

Merged pull requests:

0.5.3 (2016-06-14)

Full Changelog

Closed issues:

  • 0.5.2 throws errors if M$ Edge not installed #65

Merged pull requests:

  • Refactor code for finding the Edge directory #66 (matthewp)

0.5.2 (2016-06-09)

Full Changelog

Closed issues:

  • Microsoft Edge support #61
  • instance.on('stop'...) is called prematurely #60

Merged pull requests:

0.5.1 (2016-01-26)

Full Changelog

Closed issues:

  • Speed-up local browsers detection (Windows 7) #51

Merged pull requests:

0.5.0 (2015-11-19)

Full Changelog

Merged pull requests:

0.4.9 (2015-10-16)

Full Changelog

Closed issues:

  • readme example for local browsers hanging #38

Merged pull requests:

0.4.8 (2015-09-02)

Full Changelog

Closed issues:

  • Please fix security issues #45
  • Update restify Dependency #44
  • Update Node Dependency #43
  • Way to pass arguments to browser? #41
  • Add support for PhantomJS 2.0 #40

Merged pull requests:

  • Adding Windows CI #49 (daffl)
  • Adds PhantomJS 2.0 compatibility and update deprecated plist usage. #48 (daffl)
  • Update package dependencies #47 (daffl)
  • Added the option to pass args to local browsers #42 (auchenberg)
  • Add '--no-first-run' option for Chrome in unix.js #39 (kevinbarabash)

0.4.7 (2015-03-26)

Full Changelog

0.4.6 (2015-02-10)

Full Changelog

0.4.5 (2015-02-10)

Full Changelog

Merged pull requests:

  • Open Firefox in private mode on Unix. #37 (daffl)

0.4.4 (2014-12-10)

Full Changelog

Merged pull requests:

  • instance.stop() requires a callback to be passed #36 (diasdavid)

0.4.3 (2014-11-05)

Full Changelog

0.4.2 (2014-11-05)

Full Changelog

0.4.1 (2014-11-05)

Full Changelog

Closed issues:

  • Enable Travis CI #26

0.4.0 (2014-11-04)

Full Changelog

Closed issues:

  • Run several Chrome browsers simultaneoulsy #29
  • LOCALAPPDATA not always present? #28

Merged pull requests:

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

0.3.0 (2014-07-10)

Full Changelog

Implemented enhancements:

  • Add support for Remote Preview #10

Closed issues:

  • Current exit simulates a browser crash on Macs #23
  • Multiple tabs/windows are opened on long running launchpad instances #21
  • New release. Fix version dependencies #12
  • Needs some serious testing #6

Merged pull requests:

0.2.1 (2013-09-17)

Full Changelog

Closed issues:

  • Remote server should replace localhost with request ip #18
  • Needs to pass args for PhantomJS runner when running on Unix #13

Merged pull requests:

v0.2.0 (2012-12-16)

Full Changelog

Closed issues:

  • Killall isn't the best solution #8
  • launchpad doesn't work in Chrome if Chrome is already open #7

v0.1.0 (2012-11-21)

Closed issues:

  • Add support for Firefox Aurora #3
  • Add support for Chrome Canary #2
  • Use alternative to mdfind on MacOS #1

* This Change Log was automatically generated by github_changelog_generator