Live Debugging with Playwright CLI | Bondar Academy
Course: Claude Code for Playwright
Module: Playwright Workflows with Claude Code
Instructor: Artem Bondar
Lesson Summary
In this lesson, we explore two approaches to debugging tests in Playwright : debugging after a test has failed and debugging during a live session. Debugging After Failure The first method involves using the Playwright CLI and analyzing the trace of a failed test. This method is effective for tests that are continuously failing, allowing developers to reproduce the issue and identify fixes. Live Debugging The second method allows for debugging during a live browser session. This approach involves: Setting breakpoints in the code where the test should pause. Using the debug CLI command to run tests with debugging capabilities. Connecting to the live session using a generated session ID. Steps for Live Debugging Initialize the session and set breakpoints. Resume the test until it hits the breakpoint. Use various Playwright CLI methods (e.g., eval , console , request ) to investigate the state of the application. Diagnose issues and report findings. Clean up the Playwright CLI environment. For example, when debugging a test in article create.spec.ts , the agent can pause at a specific line, validate inputs, and analyze the state of the application to identify the root cause of a failure. This live debugging method is particularly useful for complex scenarios, providing an interactive way to diagnose and fix issues effectively. Thank you for watching, and see you in the next lesson!