This repo is a fork of main puppeteer project. It creates a version of puppeteer core specialized for use with Cloudflare Browser Run (formerly Browser Rendering).
The goals of the fork are:
- Support as much of the existing puppeteer core lib as possible.
- Minimize the size of the library for workers developers, since library space is at a premium in workers projects.
- Make library use as seamless as possible in workers.
Note that the main branch in this repo is branched off of version 22.13.1 of the library, to match the currently deployed version of Chromium on the edge.
Browser Run now has full CDP support,
so starting with @cloudflare/puppeteer version 1.1.0, the library uses the
standard CDP (Chrome DevTools Protocol) internally to communicate with Browser
Run.
Everything should work the same way, but if you encounter any issues, please
report them. You can also
downgrade to a previous puppeteer version by using compatibility_date prior to
2026-03-17 or by adding the no_websocket_standard_binary_type flag:
compatibility_date = "2026-03-16"
# or
compatibility_flags = ["nodejs_compat", "no_websocket_standard_binary_type", ...]See cloudflare/puppeteer#193 and cloudflare/workerd#6442 for details.
More information in the developer docs.
Original README follows...
Puppeteer is a Node.js library which provides a high-level API to control Chrome or Firefox over the DevTools Protocol or WebDriver BiDi. Puppeteer runs in the headless (no visible UI) by default but can be configured to run in a visible ("headful") browser.
Get started | API | FAQ | Contributing | Troubleshooting
npm i puppeteer # Downloads compatible Chrome during installation.
npm i puppeteer-core # Alternatively, install as a library, without downloading Chrome.import puppeteer from 'puppeteer';
// Or import puppeteer from 'puppeteer-core';
// Launch the browser and open a new blank page
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Navigate the page to a URL.
await page.goto('https://developer.chrome.com/');
// Set screen size.
await page.setViewport({width: 1080, height: 1024});
// Type into search box.
await page.locator('.devsite-search-field').fill('automate beyond recorder');
// Wait and click on first result.
await page.locator('.devsite-result-item-link').click();
// Locate the full title with a unique string.
const textSelector = await page
.locator('text/Customize and automate')
.waitHandle();
const fullTitle = await textSelector?.evaluate(el => el.textContent);
// Print the full title.
console.log('The title of this blog post is "%s".', fullTitle);
await browser.close();1. Uses Headless mode
By default Puppeteer launches Chrome in old Headless mode.
const browser = await puppeteer.launch();
// Equivalent to
const browser = await puppeteer.launch({headless: true});Chrome 112 launched a new Headless mode that might cause some differences in behavior compared to the old Headless implementation. In the future Puppeteer will start defaulting to new implementation. We recommend you try it out before the switch:
const browser = await puppeteer.launch({headless: 'new'});To launch a "headful" version of Chrome, set the
headless to false
option when launching a browser:
const browser = await puppeteer.launch({headless: false});2. Runs a bundled version of Chrome
By default, Puppeteer downloads and uses a specific version of Chrome so its
API is guaranteed to work out of the box. To use Puppeteer with a different
version of Chrome or Chromium, pass in the executable's path when creating a
Browser instance:
const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});You can also use Puppeteer with Firefox. See status of cross-browser support for more information.
See
this article
for a description of the differences between Chromium and Chrome.
This article
describes some differences for Linux users.
3. Creates a fresh user profile
Puppeteer creates its own browser user profile which it cleans up on every run.
See our Docker guide.
See our Chrome extensions guide.
Check out our contributing guide to get an overview of Puppeteer development.
Our FAQ has migrated to our site.
main
