Debugging Tools in Playwright

From the Playwright cheat sheet ยท Debugging & Trace Viewer ยท verified Jul 2026

Debugging Tools

Use UI mode, trace viewer, and headed mode to debug tests

bash
# Run in UI mode (interactive debugging)
npx playwright test --ui

# Run with browser visible
npx playwright test --headed

# Run with trace recording
npx playwright test --trace on

# View trace file
npx playwright show-trace trace.zip
๐Ÿ’ก UI mode is the best debugging experience โ€” shows DOM snapshots at every step
โšก Use page.pause() in your test code to open the Inspector at a specific point
๐Ÿ“Œ Traces capture screenshots, DOM snapshots, network, and console logs for every action
๐ŸŸข Upload trace.zip to trace.playwright.dev to share with teammates โ€” no install needed
debugtraceui-mode
Back to the full Playwright cheat sheet