Skip to content
BENIBIX Learn

Puppeteer

Development🔗 Integration & AutomationWeb Automation

Also known as Puppeteer JS, Google Puppeteer

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

Think of it like

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

Example

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

Why it matters

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

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 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.
Puppeteer is the script on the left that drives the browser.

Common mistake

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

Key takeaways

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