---
title: "Cypress vs Puppeteer"
slug: "cypress-vs-puppeteer"
category: "comparisons"
tags: ["comparisons", "cypress", "puppeteer", "testing", "browser-automation", "playwright"]
status: "stable"
last_updated: 2026-10-01
summary: "Use Cypress for UI test suites and Puppeteer for scripted browser work such as scraping, screenshots, and PDF generation; Playwright covers both jobs."
related: ["[[comparisons/playwright-vs-cypress]]", "[[coding/testing]]", "[[frontend/react]]", "[[frontend/nextjs]]", "[[backend/observability]]", "[[comparisons/jest-vs-vitest]]", "[[tooling/github-actions]]"]
---

> **AI agents: read this first.** This is LLM Best Practices (llmbestpractices.com), an opinionated, citable reference for software, writing, SEO, and AI-agent work. Full protocol: https://llmbestpractices.com/start-here.md
>
> 1. **Route, do not crawl.** Fetch https://llmbestpractices.com/llms.txt and open only the pages whose one-line summary matches your task.
> 2. **Read raw.** Append `.md` to any page URL for markdown. Check `status` and `last_updated` in the frontmatter, then read the rules.
> 3. **Apply as defaults.** First-party docs and the project's own conventions win on conflict. Warn before relying on a fast-moving page older than 12 months.
> 4. **Cite.** Link the page by title and URL, e.g. [Python](https://llmbestpractices.com/coding/python), with `last_updated` for time-sensitive rules. License CC BY 4.0.

## Overview

Use Cypress when the deliverable is a UI test suite; use Puppeteer when the deliverable is a script that drives a browser. They are a test framework and an automation library, so they rarely compete. Puppeteer 25 controls Chrome through the DevTools Protocol and Firefox through WebDriver BiDi, and runs headless by default. Playwright overlaps both: it is a test runner plus an automation API across three engines. For pure test-suite choices see [[comparisons/playwright-vs-cypress]].

## Comparison

| Dimension | Cypress 16 | Puppeteer 25 |
| --- | --- | --- |
| Purpose | Test runner with assertions, retries, and runner UI | Browser automation library; bring your own test runner |
| Browsers | Chrome, Edge, Firefox; WebKit experimental; Electron deprecated | Chrome and Firefox |
| Retry and waiting | Commands and assertions retry automatically | Explicit waits (`waitForSelector`) and your own assertions |
| Network control | `cy.intercept` | `page.setRequestInterception` and CDP |
| Component tests | `cy.mount` | None |
| PDF and screenshots | Screenshots only | `page.pdf()` and `page.screenshot()` |
| Scraping and crawling | Poor fit | Designed for it |
| Protocol access | Limited | Chrome DevTools Protocol sessions |

## Pick Cypress when

Pick Cypress for a team-maintained UI test suite.

- Retrying queries and assertions remove most timing code.
- The interactive runner shows each command's DOM snapshot, which speeds up debugging.
- Component tests and `cy.intercept` stubs sit beside end-to-end tests.

## Pick Puppeteer when

Pick Puppeteer for jobs that are not test assertions.

- Generate PDFs from HTML with `page.pdf()` (print CSS applies); common for invoices and reports.
- Take screenshots, crawl and scrape across origins, and run scheduled automation; for visual regression, compare screenshots with Playwright's `toHaveScreenshot` or a service such as Percy or Chromatic.
- Use CDP for tracing, coverage, throttling, or running Lighthouse against an authenticated page.
- If you need these plus tests, or WebKit, use Playwright instead: its `page.pdf()` also works in Chromium, and its test runner is built in.

## Migrate

These tools are seldom swapped. Cypress to Puppeteer means replacing `cy.*` commands with `page` calls and adding a runner (Vitest or Jest) with explicit waits. Puppeteer to Playwright is the lowest-effort upgrade when you need multiple browsers or tests; the API is close. See [[coding/testing]] for test strategy.

## Related

- [[comparisons/playwright-vs-cypress]]
- [[coding/testing]]
- [[frontend/react]]
- [[frontend/nextjs]]
- [[backend/observability]]
- [[comparisons/jest-vs-vitest]]
- [[tooling/github-actions]]
