Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk6 min

Puppeteer Tracing Options Explained: Save and Inspect Browser Traces

A practical guide to Puppeteer’s tracing options: configure categories, screenshots and buffer size, save a trace or capture returned bytes, and inspect it in Chrome DevTools.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Puppeteer’s TracingOptions control which trace categories are recorded, whether screenshots are included, how large the trace buffer is, and whether the result is saved to a file. Set options with page.tracing.start(); finish with page.tracing.stop(). Provide a path to write a file, or omit it to receive trace bytes from stop().

What Puppeteer tracing options control

The Puppeteer TracingOptions API reference, version 25.12.0, documents four options. These configure Puppeteer’s tracing API; they are not a complete list of every setting available in the lower-level Chrome DevTools Protocol tracing domain.

As an Amazon Associate I earn from qualifying purchases.

Option What it does Documented behavior
categories Sets trace categories to include or exclude. An array of strings; prefix a category with - to exclude it. The reference gives -toplevel as an example, but does not provide a fixed exhaustive category list.
path Chooses file output. When set, Puppeteer writes the trace to that path. When omitted, it does not write a file, and tracing.stop() can return the trace as a Uint8Array.
screenshots Controls whether screenshots are included in the trace. Optional boolean; defaults to false. This is distinct from page.screenshot(), which captures an image separately.
bufferSize Sets the trace-buffer size in kilobytes. If unspecified or zero, the reference reports Chromium’s default as 200 MB (200,000 KB). That is the documented default, not a guarantee for every browser build or workload.

Save a trace to a file

Start tracing before the action you want to investigate, then stop tracing after it. This example writes trace.json to the current working directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();

  await page.tracing.start({
    path: 'trace.json',
    screenshots: false,
  });

  await page.goto('https://example.com', { waitUntil: 'networkidle0' });
  // Perform the interaction or workload you want to inspect here.

  await page.tracing.stop();
} finally {
  await browser.close();
}

path is optional. If you need the trace in memory instead, leave it out; do not expect a file to be written in that mode.

Choose options for the diagnostic

Keep categories focused

Use categories to include or exclude trace categories. A category prefixed with - is excluded; for example, the API reference shows -toplevel. Since the options reference does not enumerate a complete category set, check the documentation for the Puppeteer version installed in your project before relying on a particular category name.

Include screenshots only when useful

Set screenshots: true when a visual record of the page during the trace helps explain what happened. Leave it omitted or set it to false when screenshots are not relevant. For a standalone screenshot rather than screenshots embedded in a trace, use Puppeteer’s separate page.screenshot() API.

Set a buffer size only when needed

bufferSize is measured in kilobytes. The Puppeteer 25.12.0 options reference says Chromium uses a 200 MB (200,000 KB) default if the value is absent or zero. Treat that as documentation for the referenced API and Chromium default, not as a promise that every installed browser build or long-running capture will behave identically. If a trace does not contain the detail or duration you need, review the buffer setting and the categories being recorded.

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

Return trace bytes instead of writing a file

When you omit path, tracing.stop() can return the trace as a Uint8Array, which you can save, upload, or pass to another part of your application:

import { writeFile } from 'node:fs/promises';
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();

  await page.tracing.start({ screenshots: false });
  await page.goto('https://example.com', { waitUntil: 'networkidle0' });

  const trace = await page.tracing.stop();
  if (trace) {
    await writeFile('trace.json', trace);
  }
} finally {
  await browser.close();
}

The returned value is binary data, so write it as bytes rather than converting it to ordinary text. If you prefer Puppeteer to write the file directly, pass path to tracing.start() instead.

Inspect the trace in Chrome DevTools

The Puppeteer Tracing class documentation, version 25.9.0, says traces can be opened in Chrome DevTools or a timeline viewer. In Chrome, open DevTools and use the Performance panel’s load option to open the saved trace. DevTools can also record, save, and load performance traces independently of Puppeteer.

DevTools capture settings can affect capture overhead. Its documentation describes disabling JavaScript samples as one option to reduce overhead and enabling advanced paint instrumentation as an option that significantly hinders performance. Collect only the detail needed to answer the diagnostic question, and keep capture settings consistent when comparing runs; otherwise the recording setup itself changes between comparisons.

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

Concurrency, overhead, and reliability

  • One trace per browser: The Puppeteer Tracing class reference says only one trace can be active at a time per browser. Do not start overlapping traces on separate pages in the same browser instance; finish the active trace before starting another.
  • Limit capture scope: Start immediately before the navigation or interaction of interest and stop afterward. This avoids collecting unrelated activity and makes traces easier to interpret.
  • Keep comparisons controlled: Use the same categories, screenshot setting, buffer configuration, workload, and DevTools capture settings across runs when comparing traces. This is practical guidance based on the documented controls and DevTools overhead tradeoffs, not a performance benchmark.
  • Distinguish Puppeteer from protocol options: Chrome DevTools Protocol’s Tracing domain has its own start/end methods, transfer modes, and configuration. Those protocol-level fields are not necessarily surfaced by Puppeteer’s higher-level TracingOptions.

Troubleshoot common tracing problems

No trace file appears

Check that you supplied a valid path in tracing.start() and that the process can write to its destination. Without path, Puppeteer does not write the trace to disk; capture and handle the bytes returned by tracing.stop() instead.

The trace does not include the expected visual frames

Trace screenshots are off by default. Set screenshots: true if screenshots inside the trace are needed. A separate call to page.screenshot() does not switch on trace screenshots.

A trace cannot be started while another is active

Only one trace can be active per browser according to the Tracing class documentation. Make sure the earlier capture has completed with tracing.stop() before starting another one in that browser.

The trace is missing useful events or is unwieldy

Review the categories supplied to categories, including any exclusions prefixed with -. Also check whether the chosen buffer setting fits the capture. The documented 200 MB default applies when bufferSize is absent or zero in the referenced API, but it is not a universal guarantee for all builds or workloads.

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

The API details do not match the installed package

The retrieved Puppeteer references are not version-aligned: the TracingOptions page reports version 25.12.0, while the Tracing class page reports 25.9.0. Confirm option behavior against the documentation for your installed Puppeteer version, especially if an upgrade or browser build change affects your workflow.

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 actual goal is a page screenshot rather than a performance trace, ScreenshotNeo is a website screenshot API with one GET request for a PNG, JPEG, WebP, or PDF. For example, using its documented API parameters:

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

See the ScreenshotNeo API documentation for request options. It accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; these steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Can Puppeteer capture screenshots as part of a trace?

Yes. Set screenshots: true in page.tracing.start(); the documented default is false.

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

What type does Puppeteer return when no trace path is set?

The TracingOptions reference says page.tracing.stop() can return the trace as a Uint8Array when no path is supplied.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.