# Puppeteer

> A code library that drives Chrome or Firefox. Your code does the clicks.

**Field:** Software Development  
**Category:** Integration & Automation  
**Also known as:** Puppeteer JS, Google Puppeteer

## Think of it like

Think of it like a remote for a browser. You press buttons in code, and the browser obeys.

## Definition

Puppeteer is a JavaScript library for controlling Chrome or Firefox from code. You tell it to open a page, click, type or take a picture. By default it runs the browser headless, with no window. It is often used to make screenshots and PDFs, and to scrape pages. The Chrome team builds it.

## Example

Lucy's app uses Puppeteer to turn each invoice page into a PDF. Customers get the file by email.

## Example code

```javascript
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://example.com");
await page.pdf({ path: "page.pdf" });
await browser.close();
```

Open a browser, load the page, save it as a PDF, then close.

## Why it matters

A few lines of code can now do a job a person used to click through.

## Common mistake

Leaving browsers open after a run. Each one uses memory until the server runs out.

## Three principles

- **Code controls it.** Every click is a line of code.
- **Headless default.** No window unless you ask.
- **Close it.** Always close the browser when done.

## Related terms

- [Browser Automation](https://learn.benibix.com/term/development/browser-automation)
- [Headless Browser](https://learn.benibix.com/term/development/headless-browser)
- [Playwright](https://learn.benibix.com/term/development/playwright)
- [JavaScript](https://learn.benibix.com/term/development/javascript)
- [Node.js](https://learn.benibix.com/term/development/nodejs)

![A script on the left drives a browser in the middle that has no window, labelled headless. The browser loads a web page on the right. Two outputs come back: web scraping pulls prices out of the page into a table, and browser automation clicks buttons and fills in a form. Below, a separate row shows a software robot doing the same clicks across desktop apps, labelled RPA.](https://learn.benibix.com/diagrams/dev3-web-automation.svg)

---

Source: https://learn.benibix.com/term/development/puppeteer
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
