puppeteer
Puppeteer is a Node.js library developed by Google that provides a high-level API to control Chrome or Chromium browsers over the DevTools Protocol. Originally …
Installation
npm install puppeteer
yarn add puppeteer
pnpm add puppeteer
Import
import puppeteer from 'puppeteer';
Quick Example
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'screenshot.png' });
await browser.close();About puppeteer
Puppeteer is a Node.js library developed by Google that provides a high-level API to control Chrome or Chromium browsers over the DevTools Protocol. Originally created for headless browser automation, Puppeteer enables programmatic control of browser instances for tasks including end-to-end testing, web scraping, PDF generation, screenshot capture, performance profiling, and automated form submission. Puppeteer launches a real browser instance and provides APIs for navigating pages, clicking elements, typing text, waiting for selectors and network events, intercepting requests, emulating devices and network conditions, and accessing the browser's JavaScript console output. The library automatically downloads a compatible Chromium binary on installation, ensuring consistent behavior across environments. Puppeteer supports both headless and headed (visible browser window) modes, making it useful for both CI/CD testing and development debugging. While Playwright has overtaken Puppeteer for end-to-end testing due to its multi-browser support and built-in test runner, Puppeteer remains the go-to library for Chrome-specific automation tasks, web scraping, and PDF/screenshot generation where only Chromium support is needed.
Quick Facts
| Package | puppeteer |
| Category | Testing |
| Weekly Downloads | 4M+ |
| License | Apache-2.0 |
| Install | npm install puppeteer |
Related Packages
Playwright is a modern end-to-end testing and browser automation framework developed by Microsoft th…
Cypress is a next-generation front-end testing tool built for the modern web, providing a complete e…
Cheerio is a fast, flexible, and lean implementation of jQuery designed specifically for server-side…
jsdom is a pure JavaScript implementation of web standards, primarily the WHATWG DOM and HTML Standa…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.