🧪
Testing4M+/wkApache-2.0

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
npm install puppeteer
yarn
yarn add puppeteer
pnpm
pnpm add puppeteer

Import

ESM
import puppeteer from 'puppeteer';

Quick Example

usage
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

Packagepuppeteer
CategoryTesting
Weekly Downloads4M+
LicenseApache-2.0
Installnpm install puppeteer

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.