61 / 139 · 13 Browser Automation with Playwright · Setup and First Test← prev⊞ allnext →☰ Read as one page
5.6Debugging Tools
Playwright provides multiple debugging approaches — no more guessing why a test failed.
UI Mode (--ui): Interactive timeline showing every action, network request, and DOM snapshot. The single most useful debugging tool.
Trace Viewer: Records a trace during test execution that you can replay step-by-step after the fact. Essential for CI failures.
Codegen (npx playwright codegen): Opens a browser and records your actions as test code. Useful for bootstrapping tests quickly, though the generated code usually needs cleanup.
VS Code Extension: Run, debug, and step through tests directly in the editor with breakpoints.