| 448 | self._script.clear_dom_mutation_handlers() |
| 449 | |
| 450 | def __getattr__(self, name: str) -> Any: |
| 451 | # Only reached for names Script does not define: the protocol commands |
| 452 | # (and helpers) driver.script used to expose. Keep them working while deprecated. |
| 453 | if name.startswith("__"): |
| 454 | raise AttributeError(name) |
| 455 | attribute = getattr(self._script, name) |
| 456 | replacement = _REPLACEMENTS.get(name) |
| 457 | if replacement: |
| 458 | advice = f"use {replacement} instead" |
| 459 | else: |
| 460 | advice = f"there is no supported replacement; see {BIDI_IMPLEMENTATION_DOC_URL}" |
| 461 | warnings.warn( |
| 462 | f"driver.script.{name} is deprecated and will be removed; {advice}", |
| 463 | DeprecationWarning, |
| 464 | stacklevel=2, |
| 465 | ) |
| 466 | return attribute |