Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

ScaleLeap/puppeteer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📦 @scaleleap/puppeteer

A Puppeteer convenience wrapper with stealth mode enabled by default.


Download & Installation

$ npm i -s @scaleleap/puppeteer

Usage

Exports everything the same as puppeteer-core package.

In addition to that, launch method is amended to include an extra option that can enable or disable puppeteer-extra behavior.

Also executablePath is set, and headless is set via PUPPETEER_HEADLESS environment variable.

import { launch } from '@scaleleap/puppeteer'

const await browser = launch({
  extra: {
    // is true by default, but we are just showing the example
    stealth: true
  }
})

Helper Functions

clickAndWait(page: Page, selector: string, clickOptions?: ClickOptions, navigationOptions?: NavigationOptions)

Clicks and waits for network request to complete and resolves.

Environment Variables

The following environment variables are available:

  • PUPPETEER_EXECUTABLE_PATH - the location of the Puppeteer executable.
  • GOOGLE_CHROME_BIN - same as above, but only used inside Heroku buildpack.
  • PUPPETEER_HEADLESS - Whether or not it should run in headless mode. Default: true

Heroku

For Heroku deployments, use a heroku/google-chrome buildpack.

This package will get the Chrome locations from the environment variable provided by the buildpack.

## make sure we are using NodeJS
heroku buildpacks:set heroku/nodejs

## now add chrome buildpack
heroku buildpacks:add heroku/google-chrome

References

Contributing

This repository uses Conventional Commit style commit messages.

Authors or Acknowledgments

License

This project is licensed under the MIT License.

Badges

GitHub Workflow Status NPM License Coveralls Semantic Release