Debugger
API for controlling the Playwright debugger. The debugger allows pausing script execution and inspecting the page. Obtain the debugger instance via BrowserContext.Debugger.
Methods
NextAsync
Added in: v1.59Resumes script execution and pauses again before the next action. Throws if the debugger is not paused.
Usage
await Debugger.NextAsync();
Returns
PausedDetails
Added in: v1.59Returns details about the currently paused call. Returns null if the debugger is not paused.
Usage
Debugger.PausedDetails
Returns
- PausedDetails?#
RequestPauseAsync
Added in: v1.59Configures the debugger to pause before the next action is executed.
Throws if the debugger is already paused. Use Debugger.NextAsync() or Debugger.RunToAsync() to step while paused.
Note that Page.PauseAsync() is equivalent to a "debugger" statement — it pauses execution at the call site immediately. On the contrary, Debugger.RequestPauseAsync() is equivalent to "pause on next statement" — it configures the debugger to pause before the next action is executed.
Usage
await Debugger.RequestPauseAsync();
Returns
ResumeAsync
Added in: v1.59Resumes script execution. Throws if the debugger is not paused.
Usage
await Debugger.ResumeAsync();
Returns
RunToAsync
Added in: v1.59Resumes script execution and pauses when an action originates from the given source location. Throws if the debugger is not paused.
Usage
await Debugger.RunToAsync(location);
Arguments
-
locationLocation#The source location to pause at.
Returns
Events
event PausedStateChanged
Added in: v1.59Emitted when the debugger pauses or resumes.
Usage
Debugger.PausedStateChanged += async (_, void) => {};