Puppeteer
A JavaScript library that controls Chrome and Firefox through a high-level API for automation, scraping, and testing.
Quick decision
What Puppeteer installs, when to pick Playwright, and setting the user agent
Puppeteer is a JavaScript library, maintained by the Chrome team at Google, for driving Chrome or Firefox from Node.js. npm i puppeteer installs version 25.19.0 (released 2026-11-25), which needs Node 22.12.0 or later and downloads Chrome for Testing 158.0.8127.88. To change the user agent, call page.setUserAgent({ userAgent }) before page.goto(). Pass userAgentMetadata and platform in the same call as well: in our test, a user agent string on its own made Chrome stop sending the Sec-CH-UA header and left navigator.platform reading Linux x86_64.
What npm i puppeteer gives you
The puppeteer package downloads a browser during install, and since v20 that browser is Chrome for Testing rather than Chromium. puppeteer-core is the same library without the download, for when you launch a Chrome you already have through executablePath. Firefox support uses the stable Firefox release since v23. The version pairs below come from the supported-browsers page and the npm registry, read 2026-11-28.
Puppeteer starts Chrome headless unless you pass headless: false. The default has been the new headless mode since v22. The old one now ships as a separate binary, chrome-headless-shell, which you select with headless: 'shell'. The docs call it faster for jobs that do not need all of Chrome, but say it does not behave exactly like regular Chrome.
| Item | Value | Source |
|---|---|---|
| Latest version | 25.19.0, published 2026-11-25 | npm registry |
| Node.js needed | 22.12.0 or later | npm registry (engines field) |
| Chrome it downloads | Chrome for Testing 158.0.8127.88 | Puppeteer supported-browsers page |
| Firefox it pairs with | Firefox 161.0 | Puppeteer supported-browsers page |
| Default headless mode | New headless (headless: true) | Puppeteer headless-modes guide |
| License | Apache-2.0 | GitHub repository |
Puppeteer or Playwright
The first real difference is browser coverage: only Playwright drives WebKit. After that, the choice comes down to the languages you need and whether you want a test runner in the box. Facts below are from each project’s README, read 2026-11-28.
- Pick Puppeteer for a Node.js script or service that only needs Chrome: screenshots, PDFs, scraping your own pages, or Chrome DevTools Protocol calls the higher-level API does not wrap.
- Pick Playwright when the work must also run on WebKit, when the team writes Python, Java or C#, or when you want a test runner with tracing rather than assembling one.
| Question | Puppeteer | Playwright |
|---|---|---|
| Browsers | Chrome and Firefox | Chromium, Firefox and WebKit (the Safari engine) |
| Languages | JavaScript and TypeScript on Node.js | JavaScript and TypeScript, plus official Python, .NET and Java versions |
| Test runner | None; use Jest, Mocha or node:test | Playwright Test, with auto-waiting and web-first assertions |
| Agent tooling | chrome-devtools-mcp, a Puppeteer-based MCP server the README points to | Playwright MCP (@playwright/mcp) and Playwright CLI for coding agents |
| Setting a user agent | Per page: page.setUserAgent() | Per context: browser.newContext({ userAgent }) |
Set the user agent with page.setUserAgent()
Headless Chrome announces itself. In our test the default user agent was Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/158.0.0.0 Safari/537.36, and browser.userAgent() returns the same string, so a server log can tell a Puppeteer visit from a person’s.
page.setUserAgent() now takes an options object with userAgent, userAgentMetadata and platform. The older form, setUserAgent(userAgent, userAgentMetadata), still works, but the API reference marks it obsolete. Call it on each page before page.goto(), because the setting belongs to that page only.
Change only the HeadlessChrome token. Keeps the real version and operating system and drops the word Headless. Fine for a site that only reads the User-Agent header.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
const page = await browser.newPage();
const ua = (await browser.userAgent()).replace('HeadlessChrome', 'Chrome');
await page.setUserAgent({ userAgent: ua });
await page.goto('https://example.com/');
console.log(await page.evaluate(() => navigator.userAgent));
await browser.close();Set the string, the client hints and the platform together. A page can then read the same platform from the header, navigator.platform and userAgentData. Match the brands, version and platform to the string you send.
const ua =
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ' +
'(KHTML, like Gecko) Chrome/158.0.0.0 Safari/537.36';
await page.setUserAgent({
userAgent: ua,
platform: 'Win32',
userAgentMetadata: {
brands: [
{ brand: 'Google Chrome', version: '158' },
{ brand: 'Chromium', version: '158' },
{ brand: 'Not_A Brand', version: '24' },
],
platform: 'Windows',
platformVersion: '15.0.0',
architecture: 'x86',
model: '',
mobile: false,
},
});What a site sees with each method (our test)
We ran puppeteer-core 25.19.0 on Linux on 2026-11-28 against Chrome for Testing 158.0.8127.36 (the package downloads .88, a later patch build of the same major version), loading a local page that printed the request headers and the navigator values. The table shows what each method changed.
- A Windows user agent with a Linux navigator.platform, or with no Sec-CH-UA header at all, is easy for a site to spot. Set all three values or keep the real ones.
- The --user-agent flag is the quickest way to cover every tab, but it leaves the client hints on the real values.
- A different user agent does not give you permission to automate a site. Follow its terms and robots.txt, and keep request rates low.
| Method | User-Agent header | Sec-CH-UA header | navigator.platform | Other pages |
|---|---|---|---|---|
| No change | HeadlessChrome/158.0.0.0 on X11 Linux | "Not.A/Brand";v="24", "Chromium";v="158" | Linux x86_64 | Same default |
| setUserAgent({ userAgent }) only | Your string | Not sent; navigator.userAgentData.brands was empty | Linux x86_64 | A new page went back to HeadlessChrome |
| setUserAgent with userAgentMetadata and platform | Your string | Your brands; Sec-CH-UA-Platform "Windows" | Win32 | A new page went back to HeadlessChrome |
| --user-agent launch flag | Your string, on every page | Unchanged: Chromium brands, platform "Linux" | Linux x86_64 | Applies to every page |
The examples use placeholders; keep your own key out of shared files.
Use this profile in a stack
Open the browser workspace, search for Puppeteer, and add it to a saved stack or watchlist. The workspace is free, needs no sign-in, and stores stacks in your browser only.
What it does
Puppeteer is a JavaScript library maintained by the Chrome team at Google. It provides a high-level API to control Chrome or Firefox over the DevTools Protocol or WebDriver BiDi, and it runs headless by default.
Installing the main package downloads a compatible Chrome build. The puppeteer-core package installs only the library, for cases where you point Puppeteer at a browser you manage yourself.
For agent workflows, the project points readers to chrome-devtools-mcp, a Puppeteer-based MCP server for browser automation and debugging. Puppeteer also documents experimental WebMCP support.
Capabilities on record
Browser control
Chrome and Firefox control Source-verified
Control Chrome or Firefox over the DevTools Protocol or WebDriver BiDi.
Page navigation and input Source-verified
Open pages, set viewports, type, and click through locators.
Data access
Screenshots and page capture Source-verified
Capture pages as part of scraping and QA workflows.
Setup
Bundled browser download Source-verified
The main package downloads a compatible Chrome during installation, with a browsers install command when the script is blocked.
Library-only install Source-verified
puppeteer-core installs without downloading Chrome, for bring-your-own-browser setups.
Agent integration
MCP path Source-verified
The README points to chrome-devtools-mcp, a Puppeteer-based MCP server for automation and debugging.
Quick start
Install Puppeteer
From the official README. Modern package managers may block the browser download script, and the README documents the follow-up command.
npm i puppeteer
# if the browser download was blocked:
# npx puppeteer browsers installSource: https://github.com/puppeteer/puppeteer. The example uses placeholders. Keep real credentials in your environment, not in shared configs, tickets, or repositories.
MCP support: Via a separate project. The Puppeteer README directs readers to chrome-devtools-mcp, a Puppeteer-based MCP server. AgentsUse has not published a separate MCP page for it yet.
Works with
MCP
Puppeteer-based MCP server (chrome-devtools-mcp) linked from the README.
Packages
npm: puppeteer and puppeteer-core.
Browsers
Chrome and Firefox through DevTools Protocol or WebDriver BiDi.
Deployment
Self-hosted library. You run the browsers.
Only support with a source is listed. An absent framework is unverified by AgentsUse, not incompatible.
Health and maintenance
95,765
Checked 2026-10-29
9,588
Checked 2026-10-29
Stars and forks from the GitHub repository page. No package version is shown because AgentsUse did not re-check the npm version field in this pass. Maintenance signals only, not a quality rating.
Pricing and license
Open source under Apache-2.0. The library is free to use. You provide the machine, the browser, and any infrastructure around it.
Limitations and safety
- No WebKit engine. If you need Safari-engine coverage, look at Playwright instead.
- Package managers that block install scripts will skip the Chrome download until you run the browsers install command.
- No independently checked benchmark is published for this tool yet. The maintenance and setup facts above are source checked, but they do not measure task quality or speed.
Agent tools can read data, write files, call APIs, and act through connected accounts. Start with a test account or read-only access, keep credentials in environment variables, and review agent actions before connecting anything that can spend money, send messages, or delete data.
Alternatives to Puppeteer
Playwright
Choose Playwright when you need WebKit as well as Chromium and Firefox, plus a test runner and an official MCP package.
Tradeoff: A larger surface to learn. Test tooling comes along even if you only need scripts.
Browser Use
Choose Browser Use when a model should decide the browsing steps from a plain task description.
Tradeoff: Less deterministic than direct Puppeteer code, and model calls add cost and variance.
Stagehand
Choose Stagehand when you want AI-assisted act and extract calls rather than hand-written selectors.
Tradeoff: You depend on a model for self-healing actions, and the API differs from classic Puppeteer scripts.
Common questions
What does Puppeteer do for an AI agent?
A JavaScript library that controls Chrome and Firefox through a high-level API for automation, scraping, and testing.
Is Puppeteer open source?
Yes. This profile records the license as Apache-2.0 from the official repository.
Does Puppeteer support MCP?
Via a separate project. The Puppeteer README directs readers to chrome-devtools-mcp, a Puppeteer-based MCP server. AgentsUse has not published a separate MCP page for it yet.
What is Puppeteer used for?
Driving Chrome or Firefox from Node.js code: filling in forms, taking screenshots and PDFs, testing pages and scraping content that only appears after JavaScript runs.
How do I change the user agent in Puppeteer?
Call await page.setUserAgent({ userAgent: '...' }) on the page before page.goto(). To cover every page at once, launch Chrome with the --user-agent= flag in args instead.
Is Puppeteer better than Playwright?
Neither is better across the board. Puppeteer is the smaller choice for Chrome-only Node.js scripts. Playwright adds WebKit, official Python, Java and .NET versions, and its own test runner.
What is the difference between puppeteer and puppeteer-core?
puppeteer downloads a matching Chrome for Testing when you install it. puppeteer-core is only the library, so you pass executablePath to a browser you installed yourself.
Sources and freshness
- GitHub repository: https://github.com/puppeteer/puppeteer
- Documentation: https://pptr.dev
- Puppeteer: What is Puppeteer?: https://pptr.dev/guides/what-is-puppeteer
- Puppeteer API: Page.setUserAgent(): https://pptr.dev/api/puppeteer.page.setuseragent
- Puppeteer API: Browser.userAgent(): https://pptr.dev/api/puppeteer.browser.useragent
- Puppeteer supported browsers: https://pptr.dev/supported-browsers
- Puppeteer headless modes: https://pptr.dev/guides/headless-modes
- puppeteer on the npm registry: https://www.npmjs.com/package/puppeteer
- Playwright README: https://github.com/microsoft/playwright
Checked 2026-11-28. Source-verified means the claims above trace to the listed sources; it does not mean AgentsUse ran the tool. Send corrections through the contact page. Back to the tools catalog.