Web Scraping & Automation

pyppeteer

An unofficial Python stunt double for Google's browser-automation tool, Puppeteer.

Install it: pip install pyppeteer

What does it do?

Pyppeteer ports the popular JavaScript tool Puppeteer into Python, letting you control a headless (meaning invisible, windowless) Chrome or Chromium browser to load pages, take screenshots, generate PDFs, and click around a site programmatically. Because it drives an actual Chrome engine, it renders JavaScript-heavy pages exactly the way a real user’s browser would, which simpler scraping tools can’t do. It’s ‘unofficial’ because it isn’t maintained by the Puppeteer team itself, just built by community volunteers translating its ideas into Python. That community-maintained status means it’s less actively developed today than newer alternatives built specifically for Python from the start.

See it in action

This code opens an invisible Chrome browser, loads a webpage, saves a screenshot of it as an image file, and then closes the browser.

import asyncio
from pyppeteer import launch

async def main():
    browser = await launch()
    page = await browser.newPage()
    await page.goto("https://example.com")
    await page.screenshot({"path": "example.png"})
    await browser.close()

asyncio.run(main())

Why would a non-developer care?

Some of the most useful things you might want to automate — printing a webpage as a clean PDF, screenshotting a page as it actually renders, or scraping a site that only shows data after scripts run — require a real browser engine, not just raw HTML. Pyppeteer brought that Chrome-powered capability into Python before more actively maintained alternatives existed. It mattered most during the window when it was one of the only ways to get headless Chrome automation directly in Python.

Real-world examples

Pyppeteer saw use in projects that needed to generate PDF reports from web pages or scrape JavaScript-rendered sites before Playwright existed as a more actively maintained Python-native alternative. It’s the kind of tool many tutorials from a few years ago still reference, even though newer projects have largely moved on. Without a Chrome-driving tool like it at the time, Python developers doing that work would have had to shell out to JavaScript-based Puppeteer directly.

Who uses it

Developers with existing legacy scripts built around it, or anyone specifically wanting Puppeteer’s exact behavior replicated in Python.

How it compares to alternatives

Playwright, built later and officially maintained by Microsoft, does essentially everything Pyppeteer does but more reliably and across more browsers, and has largely superseded it for new projects. Selenium remains the older, more broadly supported alternative for browser automation generally. Most developers starting fresh today would reach for Playwright over Pyppeteer.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries