Nominating Presidential Muppets


    1.3.3 • Public • Published


    Lighthouse Puppeteer - NPM Package

    latest release NPM release PayPal donation Buy me a coffee Become a Patron

    DISCLAIMER: As-of 2021, this product does not have a free support team anymore. If you want this product to be maintained, please support on Patreon.

    (This product is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added.)

    • Google Chrome Headless is the Google Chrome browser that can be started without graphical interface to accomplish several tasks (PDF printing, performance, automation...)
    • Google Lighthouse analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices.
    • Google Puppeteer is a tool to automate tasks on a Chrome (headless) browser.


    The purpose of this package image is to produce performance report for several pages in connected mode and in an automated (programmated) way.

    It uses lighthouse-batch to be able to automate export of multiple


    npm install -g google-lighthouse-puppeteer --unsafe-perm=true

    CLI Usage

    $> lighthouse-puppeteer -h
      -f, --file FILE         Path to your testcase REQUIRED (default option)
                              (example: /home/chrome/testcases/mytestcase.js)
      -p, --port PORT         Chrome headless debug port (default: 9222)
      -c, --chromium_params   Optional parameters to pass to chrome/chromium browser
                                (example: "- --no-sandbox --disable-setuid-sandbox --ssl-version-max=tls1.1")
      -v, --verbose           Providing this option once will show more info from Lighthouse.
                                Providing it twice will additionally provide info from `lighthouse-batch`.
      -h, --help              Print this usage guide.
      -d, --output_directory FOLDER   Path to output reports
                                      (default: /home/chrome/reports)
      -w, --html                      Renders HTML reports alongside JSON reports
      -l, --lighthouse_params         Optional parameters to pass to lighthouse
                                      (example: "- --quiet --perf")
      You can add your options for puppeteer by prefixing them with --puppeteer-
      example: "--puppeteer-ignoreHTTPSErrors --puppeteer-slowMo 20"


    You can see or for more informations.


    If you want to use your own Chrome/Chromium instead of the provided by Puppeteer, you can add the following two environment variables:

    # This environment is used by puppeteer to know where your chrome browser installed in located
    # This environment tells puppeteer and npm to not install the browser in node_modules

    Package Usage

    const lp = require('google-lighthouse-puppeteer');
    const options = {};
    lp.exec('/path/to/my/test.js', options)
        .then(() => console.log('everything ok'))
        .catch((err) => console.error(err));


    You can change some options like in CLI :

        "main": {
          "verbose":[true, true]
        "lighthouse": {
        "chromium": "--no-sandbox --disable-setuid-sandbox --ssl-version-max=tls1.1",
        "_unknown": [

    For puppeteer, all params must be added in the _unknown entry and are prefixed with --puppeteer-. Each value must be in separated entry.

    verbose is an array of true, the more true the more talkative the application.

    Lighthouse params can be added respecting their documentation


    You should create a testcase file named whateverYouWant.js.

    This file must module.exports an object which must contain two methods : connect and getUrls.


    This method must return a Promise which resolves the browser (first argument received of the method connect).

    The purpose of this method is to connect the user to the browser.


    This method must return an array of string for the url to be tested. You can put url restricted by connection since the connect method will grant you access.


    class whateverYouWant
        getUrls() {
            return [
        connect(browser) {
            return new Promise(async (resolve, reject) => {
                const page = await browser.newPage();
                await page.goto('', {waitUntil: 'load'});
                await page.type('#login', 'admin');
                await page.type('#password', 'admin');
                await page.$eval('#form input[type=submit]', x =>;
                await page.waitForNavigation({waitUntil: 'networkidle2'});
    module.exports = new whateverYouWant();


    npm i google-lighthouse-puppeteer

    DownloadsWeekly Downloads






    Unpacked Size

    147 kB

    Total Files


    Last publish


    • jaymoulin