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 cdp.dom_debugger.DOMBreakpointType

DOM breakpoint type.

ATTRIBUTE_MODIFIED = 'attribute-modified'
NODE_REMOVED = 'node-removed'
SUBTREE_MODIFIED = 'subtree-modified'
class cdp.dom_debugger.EventListener(type_, use_capture, passive, once, script_id, line_number, column_number, handler=None, original_handler=None, backend_node_id=None)

Object event listener.

backend_node_id = None

Node the listener is added to (if any).

column_number = None

Column number in the script (0-based).

handler = None

Event handler function value.

line_number = None

Line number in the script (0-based).

once = None

EventListener’s once flag.

original_handler = None

Event original handler function value.

passive = None

EventListener’s passive flag.

script_id = None

Script id of the handler code.

type_ = None

EventListener’s type.

use_capture = None

EventListener’s useCapture.

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.

cdp.dom_debugger.get_event_listeners(object_id, depth=None, pierce=None)

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.

cdp.dom_debugger.remove_dom_breakpoint(node_id, type_)

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]

cdp.dom_debugger.remove_event_listener_breakpoint(event_name, target_name=None)

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]

cdp.dom_debugger.remove_instrumentation_breakpoint(event_name)

Removes breakpoint on particular native event.

EXPERIMENTAL

Parameters:event_name (str) – Instrumentation name to stop on.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.dom_debugger.remove_xhr_breakpoint(url)

Removes breakpoint from XMLHttpRequest.

Parameters:url (str) – Resource URL substring.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.dom_debugger.set_dom_breakpoint(node_id, type_)

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]

cdp.dom_debugger.set_event_listener_breakpoint(event_name, target_name=None)

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]

cdp.dom_debugger.set_instrumentation_breakpoint(event_name)

Sets breakpoint on particular native event.

EXPERIMENTAL

Parameters:event_name (str) – Instrumentation name to stop on.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.dom_debugger.set_xhr_breakpoint(url)

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.