跳到正文
本页尚未翻译成中文,以下为英文原文。 查看英文版

Debugger ​

Added in: v1.59

API for controlling the Playwright debugger. The debugger allows pausing script execution and inspecting the page. Obtain the debugger instance via browser_context.debugger.

Methods ​

debugger.next() ​

Added in: v1.59

Resumes script execution and pauses again before the next action. Throws if the debugger is not paused.

debugger.paused_details() ​

Added in: v1.59

Returns details about the currently paused call. Returns null if the debugger is not paused.

Returns

  • null | Object

debugger.request_pause() ​

Added in: v1.59

Configures the debugger to pause before the next action is executed.

Throws if the debugger is already paused. Use debugger.next() or debugger.run_to() to step while paused.

Note that page.pause() is equivalent to a "debugger" statement — it pauses execution at the call site immediately. On the contrary, debugger.request_pause() is equivalent to "pause on next statement" — it configures the debugger to pause before the next action is executed.

debugger.resume() ​

Added in: v1.59

Resumes script execution. Throws if the debugger is not paused.

debugger.run_to() ​

Added in: v1.59

Resumes script execution and pauses when an action originates from the given source location. Throws if the debugger is not paused.

Arguments

  • location Object

    The source location to pause at.

    • file string
    • line int (optional)
    • column int (optional)

Events ​

debugger.on("pausedStateChanged") ​

Added in: v1.59

Emitted when the debugger pauses or resumes.

Event data

  • void

基于 Apache 2.0 许可证发布。