DOMDebugger#

DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript execution will stop on these operations as if there was a regular breakpoint set.

Types#

Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.

class DOMBreakpointType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

DOM breakpoint type.

SUBTREE_MODIFIED = 'subtree-modified'#
ATTRIBUTE_MODIFIED = 'attribute-modified'#
NODE_REMOVED = 'node-removed'#
class CSPViolationType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

CSP Violation type.

TRUSTEDTYPE_SINK_VIOLATION = 'trustedtype-sink-violation'#
TRUSTEDTYPE_POLICY_VIOLATION = 'trustedtype-policy-violation'#
class EventListener(type_, use_capture, passive, once, script_id, line_number, column_number, handler=None, original_handler=None, backend_node_id=None)[source]#

Object event listener.

type_: str#

EventListener’s type.

use_capture: bool#

EventListener’s useCapture.

passive: bool#

EventListener’s passive flag.

once: bool#

EventListener’s once flag.

script_id: ScriptId#

Script id of the handler code.

line_number: int#

Line number in the script (0-based).

column_number: int#

Column number in the script (0-based).

handler: Optional[RemoteObject] = None#

Event handler function value.

original_handler: Optional[RemoteObject] = None#

Event original handler function value.

backend_node_id: Optional[BackendNodeId] = None#

Node the listener is added to (if any).

Commands#

Each command is a generator function. The return type Generator[x, y, z] indicates that the generator yields arguments of type x, it must be resumed with an argument of type y, and it returns type z. In this library, types x and y are the same for all commands, and z is the return type you should pay attention to. For more information, see Getting Started: Commands.

get_event_listeners(object_id, depth=None, pierce=None)[source]#

Returns event listeners of the given object.

Parameters:
  • object_id (RemoteObjectId) – Identifier of the object to return listeners for.

  • depth (Optional[int]) – (Optional) The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.

  • pierce (Optional[bool]) – (Optional) Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). Reports listeners for all contexts if pierce is enabled.

Return type:

Generator[Dict[str, Any], Dict[str, Any], List[EventListener]]

Returns:

Array of relevant listeners.

remove_dom_breakpoint(node_id, type_)[source]#

Removes DOM breakpoint that was set using setDOMBreakpoint.

Parameters:
  • node_id (NodeId) – Identifier of the node to remove breakpoint from.

  • type – Type of the breakpoint to remove.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

remove_event_listener_breakpoint(event_name, target_name=None)[source]#

Removes breakpoint on particular DOM event.

Parameters:
  • event_name (str) – Event name.

  • target_name (Optional[str]) – (EXPERIMENTAL) (Optional) EventTarget interface name.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

remove_instrumentation_breakpoint(event_name)[source]#

Removes breakpoint on particular native event.

Deprecated since version 1.3.

EXPERIMENTAL

Parameters:

event_name (str) – Instrumentation name to stop on.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

Deprecated since version 1.3.

remove_xhr_breakpoint(url)[source]#

Removes breakpoint from XMLHttpRequest.

Parameters:

url (str) – Resource URL substring.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

set_break_on_csp_violation(violation_types)[source]#

Sets breakpoint on particular CSP violations.

EXPERIMENTAL

Parameters:

violation_types (List[CSPViolationType]) – CSP Violations to stop upon.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

set_dom_breakpoint(node_id, type_)[source]#

Sets breakpoint on particular operation with DOM.

Parameters:
  • node_id (NodeId) – Identifier of the node to set breakpoint on.

  • type – Type of the operation to stop upon.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

set_event_listener_breakpoint(event_name, target_name=None)[source]#

Sets breakpoint on particular DOM event.

Parameters:
  • event_name (str) – DOM Event name to stop on (any DOM event will do).

  • target_name (Optional[str]) – (EXPERIMENTAL) (Optional) EventTarget interface name to stop on. If equal to `"*"` or not provided, will stop on any EventTarget.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

set_instrumentation_breakpoint(event_name)[source]#

Sets breakpoint on particular native event.

Deprecated since version 1.3.

EXPERIMENTAL

Parameters:

event_name (str) – Instrumentation name to stop on.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

Deprecated since version 1.3.

set_xhr_breakpoint(url)[source]#

Sets breakpoint on XMLHttpRequest.

Parameters:

url (str) – Resource URL substring. All XHRs having this substring in the URL will get stopped upon.

Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

Events#

There are no events in this module.