MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / add_dom_mutation_handler

Method add_dom_mutation_handler

py/selenium/webdriver/remote/script.py:426–440  ·  view source on GitHub ↗

Add a handler called with a ``DomMutation`` for each observed DOM mutation. Args: callback: Function called with a ``DomMutation``. mutation_types: Any of ``attributes``, ``childList`` and ``characterData``, as a string or an iterable of strings.

(
        self, callback: Callable[[DomMutation], Any], mutation_types: str | Iterable[str] | None = None
    )

Source from the content-addressed store, hash-verified

424 self._script.remove_javascript_error_handler(callback_id)
425
426 def add_dom_mutation_handler(
427 self, callback: Callable[[DomMutation], Any], mutation_types: str | Iterable[str] | None = None
428 ) -> int:
429 """Add a handler called with a ``DomMutation`` for each observed DOM mutation.
430
431 Args:
432 callback: Function called with a ``DomMutation``.
433 mutation_types: Any of ``attributes``, ``childList`` and
434 ``characterData``, as a string or an iterable of strings.
435 Defaults to ``("attributes",)``.
436
437 Returns:
438 An id for ``remove_dom_mutation_handler()``.
439 """
440 return self._script.add_dom_mutation_handler(callback, mutation_types)
441
442 def remove_dom_mutation_handler(self, callback_id: int) -> None:
443 """Remove a handler added by ``add_dom_mutation_handler()``."""

Calls

no outgoing calls