Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To generate a Puppeteer script, open Chrome DevTools’ Recorder panel, record or select a flow, click Export, and choose Puppeteer. Chrome downloads a JavaScript file that replays the recorded actions and can be edited for tests, loops, assertions, and CI. The export is one-way: Puppeteer JavaScript cannot be imported back into Recorder, so keep a JSON copy when you need a round-trip editable flow.

Open the Recorder panel

Recorder is built into Chrome DevTools and can record, replay, edit, inspect, and export browser flows. Open DevTools on the page where the workflow starts, then use either route documented by Chrome:

  1. Open the DevTools Command menu and search for Recorder panel.
  2. Or choose More options (the three-dot menu) > More tools > Recorder panel.

See Chrome’s Recorder overview for the current panel location and terminology.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Record a flow that exports cleanly

  1. In Recorder, select Start new recording (or open an existing flow).
  2. Give the flow a descriptive name and start recording.
  3. Perform the user journey exactly as a real user would: navigate, click, type, submit, and wait for results.
  4. Stop recording when the final state is visible.
  5. Review every step before exporting. Recorder automatically includes initial viewport and navigation steps; edit parameters, remove accidental actions, and add waits where the application needs them.

Use stable selectors where possible. A generated selector tied to a changing class name may work today and fail after a redesign. Prefer accessible roles, labels, data attributes, or other identifiers your team controls. Recorder’s step editor and side-by-side code view let you inspect what each action will become.

Export the Puppeteer JavaScript

  1. Select the flow in Recorder.
  2. Click Export.
  3. Choose Puppeteer (not Puppeteer Replay or a Lighthouse variant).
  4. Save the downloaded .js file in your project.

The exact export choices and their limitations are listed in Chrome’s Recorder reference. The result is JavaScript intended to run with Puppeteer. It is a starting point for maintainable automation, not a guarantee that every selector, timing assumption, login state, or third-party challenge will remain valid.

Install Puppeteer and run the file

In a new project, initialize npm and install Puppeteer:

mkdir recorder-flow
cd recorder-flow
npm init -y
npm install puppeteer
node your_export.js

Puppeteer normally downloads a compatible browser during installation. If your organization supplies Chrome separately, configure Puppeteer’s executable path in the exported script or project setup according to your deployment policy. Run the command from the directory containing the file; a successful run should open a browser, perform the recorded actions, and exit or leave the browser open according to the generated code.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make the generated file safer to maintain

  • Replace brittle selectors with stable attributes or role-based locators.
  • Move URLs, usernames, and other environment values into variables or environment variables; never commit passwords or API keys.
  • Keep explicit waits tied to meaningful page states, such as a selector becoming visible, rather than adding arbitrary long delays everywhere.
  • Add assertions after important actions so a run fails when the wrong page or message appears.
  • Wrap browser cleanup in a finally block when you extend the script, so failures do not leave orphaned processes.
  • Parameterize repeated data instead of recording the same sequence many times.

Choose the right Recorder export

Export Output and replay target Can it be imported into Recorder? Best use
Puppeteer JavaScript for Puppeteer No Customize a runnable script, add assertions, or integrate with a JavaScript test project.
JSON Human-readable recording data Yes Keep an editable source flow and move it between Recorder sessions.
@puppeteer/replay JSON steps for the Puppeteer Replay library Not as a Puppeteer JavaScript file CI/CD workflows where JSON steps remain the maintained artifact.
Puppeteer (for Firefox) Puppeteer code targeting Chrome and Firefox through WebDriver BiDi support No Cross-browser automation when Firefox execution is a requirement.
Puppeteer (including Lighthouse analysis) Puppeteer code plus Lighthouse analysis No Capture a flow and produce a Lighthouse report as part of the run.
Extension formats Defined by an installed Recorder extension Depends on the extension Organization-specific exporters or formats Chrome does not ship.

For the Lighthouse-inclusive example, Chrome documents installing both packages and running the export with npm i puppeteer lighthouse followed by node your_export.js. That dependency pair applies to that export, not to an ordinary Puppeteer export.

Debug a recording before treating it as a test

Recorder includes controls to slow replay, pause, resume, set breakpoints, and advance one step at a time. Use them to locate the first failing action instead of debugging the final error. Edit a step’s selector, value, or wait condition, replay from the relevant point, and then export again if the corrected flow is still best represented as generated code.

Common failures and fixes

  • Recorder is missing: open DevTools on a normal webpage and use the Command menu or More tools > Recorder panel. Browser-managed configurations can hide DevTools features.
  • The script fails at a click: the element may be rendered later, covered by a modal, inside an iframe, or represented by a selector that changed. Re-record the step, add a state-based wait, and handle the frame or modal explicitly.
  • Navigation times out: confirm the URL is reachable from the machine running Puppeteer, increase the navigation timeout only when the page is known to be slow, and investigate blocked resources or authentication redirects.
  • Login does not replay: recordings do not remove the need for credentials, session cookies, multi-factor authentication, or bot checks. Use a controlled test account and inject secrets securely.
  • Headless and headed behavior differ: compare viewport, user agent, permissions, timezone, and timing. Reproduce the CI environment locally where possible.
  • Generated code is hard to review: retain the JSON recording as the editable source, then hand-refactor the JavaScript and add assertions rather than repeatedly exporting over your changes.

Recorder extensions and managed browsers

Chrome documents Recorder extension APIs as a preview feature. The API reference lists export functionality beginning with Chrome 105 and replay functionality beginning with Chrome 112; these are availability thresholds, not a promise that every extension works in every managed environment. See the extension guide and Recorder API reference.

Rank #3
Sale
Malwarebytes Standard, Premium Security| Amazon Exclusive | 18 Months, 2 Devices | Windows, Mac OS, Android, Apple iOS, Chrome [Online Code]
  • AWARD WINNING Antivirus, anti-malware, anti-spyware & more
  • 24/7 REAL TIME PROTECTION against emerging malware threats, including ransomware and viruses- without slowing you down.
  • PROTECTS YOUR DEVICES ON MULTIPLE PLATFORMS: Get cyber protection for your computers, smartphones, or tablets- Compatible with Windows, Mac, Android, iOS
  • DOWNLOAD AND INSTALL INSTANTLY
  • UNMATCHED THREAT DETECTION: We found malware on 40 percent of devices that already had a third-party antivirus installed.

Extensions may not appear on chrome:// pages. Chrome’s guide also notes that you may need to open a new tab after installation, and administrator policy can block extension behavior. Test an extension in the same Chrome channel and policy environment used by your team.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Performance, reliability, and version control

  • Keep flows focused: one business journey per recording makes failures easier to diagnose and reruns faster.
  • Control waiting: network-idle waits can be expensive on pages with analytics or long-lived connections; prefer a specific completion selector when one exists.
  • Run deterministically: seed test data, isolate accounts, fix viewport dimensions, and avoid depending on ads, clocks, or random content.
  • Review browser compatibility: pin Puppeteer and browser versions in your project, then upgrade deliberately and replay representative flows.
  • Store both artifacts: commit the hand-maintained JavaScript plus the Recorder JSON when the team needs to regenerate or inspect the original flow.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean image or PDF of a page rather than an interactive test, ScreenshotNeo provides a website screenshot API and MCP server. A single request returns PNG, JPEG, WebP, or PDF; it accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo documentation for options such as full-page and element capture, device presets, dark mode, custom CSS and JavaScript, waits, request blocking, headers and cookies, PDFs, caching, signed links, asynchronous webhooks, bulk capture, and the MCP tools take_screenshot, get_page_info, and capture_pdf. AI agents using Claude, Cursor, or another MCP client can take screenshots without you wiring a browser runner. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

FAQ

Can I import an edited Puppeteer script back into Recorder?

No. Chrome documents Puppeteer export as a one-way JavaScript export. Keep or import the JSON recording when Recorder must remain the editable source.

Which export is best for CI?

Use Puppeteer for JavaScript-based test suites, or @puppeteer/replay when you want JSON steps replayed by the Puppeteer Replay library. The choice depends on whether code or JSON is your maintained artifact.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can an extension add a format that Chrome does not provide?

Yes. Recorder extensions can provide custom export or replay behavior, subject to the extension’s implementation, Chrome version, page context, and administrator policy.

Frequently Asked Questions

Does Recorder capture passwords?

Treat recorded values as sensitive test data. Remove secrets from exported files and use secure environment variables or test credentials instead.

Why keep JSON if I already have JavaScript?

JSON is the Recorder-compatible, human-readable representation that can be edited and imported; exported Puppeteer JavaScript cannot be imported back.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.