Installation
To use Puppeteer in your project, run:
- npm
- Yarn
- pnpm
npm i puppeteer
yarn add puppeteer
pnpm add puppeteer
When you install Puppeteer, it automatically downloads a recent version of
Chrome for Testing (~170MB macOS, ~282MB Linux, ~280MB Windows) and a chrome-headless-shell binary (starting with Puppeteer v21.6.0) that is guaranteed to
work
with Puppeteer. The browser is downloaded to the $HOME/.cache/puppeteer folder
by default (starting with Puppeteer v19.0.0). See configuration for configuration options and environmental variables to control the download behavior.
For every release since v1.7.0 we publish two packages:
puppeteer is a product for browser automation. When installed, it downloads
a version of Chrome, which it then drives using puppeteer-core. Being an
end-user product, puppeteer automates several workflows using reasonable
defaults that can be customized.
puppeteer-core is a library to help drive anything that supports DevTools
protocol. Being a library, puppeteer-core is fully driven through its
programmatic interface implying no defaults are assumed and puppeteer-core
will not download Chrome when installed.
You should use puppeteer-core if you are
connecting to a remote browser
or managing browsers yourself.
If you are managing browsers yourself, you will need to call
puppeteer.launch with
an explicit
executablePath
(or channel if it's
installed in a standard location).
When using puppeteer-core, remember to change the import:
import puppeteer from 'puppeteer-core';