October 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 ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

How to Debug Playwright and Puppeteer Tests

A practical guide to isolating Playwright and Puppeteer test failures, choosing the right debugger, reading traces, and investigating CI-only problems.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To debug Playwright and Puppeteer tests, first isolate the failing test, then collect evidence from the part of the system that may be failing: the test runner, page JavaScript, browser process, or CI environment. In Playwright, use Inspector or UI Mode for interactive diagnosis and capture traces for failures, especially in CI. In Puppeteer, make execution visible, forward page-console messages, and choose browser DevTools, Node’s inspector, or process logs based on where the suspected code runs.

Start by narrowing the failure

Run the smallest test scope that still reproduces the problem. A smaller run cuts unrelated output and makes it easier to see whether the failure is repeatable. If the issue may depend on a browser, retain the relevant project selection rather than silently changing the test environment.

Playwright: run one test, file, or project

The Playwright CLI accepts a test file, a line number, and a project selection. For example:

npx playwright test example.spec.ts:10 --project=chromium

Use the test file or line selection to target the failure; add --project when you need to isolate or compare configured browser projects. See the Playwright command-line reference for current selection syntax and options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Puppeteer: reduce the script to the failing path

Puppeteer is commonly used from a Node.js script rather than Playwright Test’s runner. Temporarily remove unrelated navigation and interactions, keeping the failing sequence and the same launch options. This helps distinguish a timing or page-state issue from setup or teardown behavior.

Make the browser interaction observable

Playwright Inspector

Run the failing test with debug mode to open a headed browser and the Playwright Inspector:

npx playwright test --debug
npx playwright test example.spec.ts --debug
npx playwright test example.spec.ts:10 --debug

In the Inspector, step through actions, inspect actionability information, and use the locator picker or live editing to check the target. A page.pause() call can stop the test at a chosen point for inspection. This is useful for seeing what the test is about to do, but a successful manual step-through does not by itself prove why an unattended run failed. Details are in Playwright’s debugging guide.

Playwright UI Mode

For a broader view of a run, launch UI Mode:

npx playwright test --ui

UI Mode lets you walk through test steps and inspect errors, logs, network requests, DOM snapshots, and locators. It can provide more context than a terminal stack trace alone. The running and debugging tests guide documents the workflow.

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.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Puppeteer headed mode and slow motion

For Puppeteer, a headed browser and a short delay between operations can make a fast interaction sequence easier to observe:

const browser = await puppeteer.launch({ headless: false, slowMo: 250 });
const page = await browser.newPage();

page.on('console', msg => console.log('PAGE LOG:', msg.text()));

Attach the console listener before the actions you want to diagnose. Headed mode and slowMo help expose unexpected page state or ordering; they are observation aids, not proof of a root cause. Puppeteer’s debugging guide covers these methods.

Check whether the locator or page state is wrong

Playwright actionability

When a click or other action stalls, inspect the locator’s match count and the Inspector’s actionability log. Determine whether the target was visible, enabled, stable, and ready when the test acted. A locator that matches nothing, matches multiple elements, or remains blocked by an overlay points to a different fix than a click that completed but produced the wrong page state.

Puppeteer locator waits and selector methods

Puppeteer’s locator API waits for elements and checks action preconditions. Do not assume that lower-level selector methods have identical waiting or retry behavior. Check which API the test uses and whether its documented behavior matches the timing the test needs. See Puppeteer’s page interactions guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Collect evidence that matches the failure

Playwright traces

A Playwright trace provides an action timeline and related browser evidence, including snapshots, network activity, and logs. For failures that appear in CI, traces can show what happened in the run that failed rather than relying on a local reproduction. The Playwright best-practices guidance recommends traces for CI failures and warns that recording traces for every test can add substantial overhead.

For Playwright Test, configure trace collection through the test runner when you need test context and assertions. The lower-level context tracing API does not record test assertions, so it is not a like-for-like replacement for a test-runner trace. Open a trace with:

npx playwright show-trace trace.zip

See Playwright best practices and the Tracing API reference for configuration details and trade-offs.

Puppeteer browser traces and console output

Puppeteer can record a browser trace for inspection in Chrome DevTools or a timeline viewer:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
await page.tracing.start({ path: 'trace.json' });
// Run the interactions you need to investigate.
await page.tracing.stop();

This is browser/timeline evidence, not the same artifact as a Playwright Test trace with runner context. For Puppeteer tracing options, see the Tracing class reference.

To expose page console messages in Node, register page.on('console', ...) before the suspect interaction, as in the earlier snippet. A screenshot can show a page at one instant, but it cannot by itself reconstruct the sequence of actions, requests, and state changes that led there.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Debug the correct execution context in Puppeteer

Puppeteer failures can originate in Node.js test code, JavaScript running in the page, or the browser process. Select the debugger or logging method for the suspected layer instead of treating all browser-related errors as page errors.

Node.js script or test code

Put a debugger statement in the Node-side script and launch Node with --inspect-brk to pause for inspection. This targets the test’s Node execution, not JavaScript inside the page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Code running in the page

Launch Puppeteer with devtools: true and put a debugger statement inside the callback passed to page.evaluate. That lets browser DevTools pause page-side execution where the suspect code runs.

Browser launch or protocol behavior

Use dumpio: true in the launch options to forward browser-process output. For lower-level Puppeteer logging, the debugging guide documents NODE_DEBUG="puppeteer:*". Treat protocol debug output as potentially sensitive: it may include information that should not be shared publicly. Consult Puppeteer’s debugging guide before collecting or publishing logs.

Handle failures that occur only in CI

A CI-only failure is a reproduction and evidence problem until you have comparable runs. Capture Playwright traces on failure rather than tracing every test by default; the latter carries a performance cost. A common failure-focused policy is to retain a trace on the first retry of a failed test, then inspect the trace for the action timeline, snapshots, requests, and logs.

Compare the failing CI run with the local run across the browser project, test configuration, environment, and logs. A local headed run that passes does not establish why CI failed. If you run headed tests on Linux in CI, Playwright’s CI documentation notes that Xvfb is required. See Playwright’s continuous integration guidance.

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

Useful logging commands

These commands add evidence without changing the basic test flow:

# Playwright API-level logging
DEBUG=pw:api npx playwright test

# Playwright browser launch logging
DEBUG=pw:browser npx playwright test

Use API logging when you need to see Playwright operations and browser logging when investigating launch-related behavior. Keep debug logs private if they may contain sensitive page or environment details.

Troubleshoot common symptoms

Symptom What to inspect Next step
Playwright action times out Inspector actionability details, locator match count, visibility, enabled state, stability, and overlays. Correct the locator or page precondition; use a pause or UI Mode to inspect the state at the failing action.
Playwright passes locally but fails in CI Failure trace, browser project, configuration, environment, and CI logs. Collect traces for failures or retries and compare the actual CI run with the local run. Do not infer a cause from local headed success alone.
Puppeteer click appears to run before the target is ready Whether the code uses a locator or a lower-level selector method, and the API’s documented waiting behavior. Use an interaction API whose wait and preconditions fit the operation, or explicitly wait for the required page state.
Page error is missing from Node output Whether a page-console listener was attached before the interaction and whether the fault is in page or Node code. Forward page console messages; use browser DevTools for page execution or Node’s inspector for script execution.
Browser launch or protocol failure is unclear Browser-process output and Puppeteer debug logs. Try dumpio: true or documented protocol logging, handling collected output as potentially sensitive.

Or skip the browser setup

If the task is to capture a webpage rather than debug an interaction test, ScreenshotNeo can return a screenshot or PDF with one GET request. For example, using cURL:

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

See the ScreenshotNeo documentation for request options. Before capture, it accepts cookie or consent banners and removes 60+ known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses report page verdict and billing headers. An MCP server provides screenshot tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card required.

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

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 *

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

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.