Manuals / Playwright with Python / Chapter 32

Part 4 · Advanced Techniques · advanced · ~45 min · Chapter 32 of 61

24. Debugging Tools

Playwright Inspector PWDEBUG=1 pytest test_login.py What it does: Opens a GUI tool that pauses test execution and lets you step through actions one at a time, inspect the current page state, and even generate locator code by pointing at elements live. Pointers: Invaluable while first writing a new test or diagnosing exactly where an existing one breaks — far faster than repeatedly adding print sta

Path progress
52%

Step 1 of 2

PWDEBUG=1 pytest test_login.py

What it does: Opens a GUI tool that pauses test execution and lets you step through actions one at a time, inspect the current page state, and even generate locator code by pointing at elements live. Pointers: Invaluable while first writing a new test or diagnosing exactly where an existing one breaks — far faster than repeatedly adding print statements and re-running.

PWDEBUG=1 pytest test_login.pyDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Page under testdrag · tap →Multi-browserdrag · tap →Automation pathdrag · tap →Tooling nodedrag · tap →
Was this step clear?
Chapter learning outcomes
  • PWDEBUG=1 pytest test_login.py
  • Trace Viewer

Clear these before you leave

Side quest

24. Debugging Tools deliverable

Apply one idea from “PWDEBUG=1 pytest test_login.py” in a small script or note.