Straight from the official documentation (opens new window):
Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless by default, but can be configured to run full (non-headless) Chrome or Chromium.
Let's break that down:
- high-level API: a human-readable interface for interacting with webpages through the browser (Chrome or Chromium) using...
- ...the DevTools Protocol: the standard protocol used to expose Chrome functionality up to various development-oriented tools
- headless: running without a graphical user interface.
It is worth noting that Puppeteer is an open-source project maintained by the Chrome DevTools team. Find out how you can contribute (opens new window) to it!
# Main use cases
We now know what Puppeteer is. The next question is "what can we use it for?"
- Test automation in modern web applications: verifying that the features we are exposing our users/customers to are actually behaving as expected.
- Taking screenshots of web pages: useful for a variety of different uses going from simple archiving to automated comparison for e.g. visual testing.
- Scraping web sites for data: extracting data from websites for later retrieval or analysis.
- Automating interaction of web pages: speed up and scale any sort of sequence of actions we would like to perform on a website automatically.
In this guide we will be looking at all these different use cases.
# Philosophy and goals
- It currently supports mainly Chrome, but also Firefox nightly - support for more browsers might happen in the future. Still, Puppeteer is not a cross-browser testing tool. Its main focus is on Chrome and being fast and powerful.
- Like for the Chromium project, the focus is on speed, security, stability and simplicity (opens new window). Expect these four things to be prioritised when a tradeoff is on the horizon.
- Chromium is bundled together with Puppeteer to minimise incompatibilities. This means every Puppeteer version has a specific Chromium version (opens new window) it supports.