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

Method shadow_root

py/selenium/webdriver/remote/webelement.py:282–297  ·  view source on GitHub ↗

Get the shadow root attached to this element if present (Chromium, Firefox, Safari). Returns: The ShadowRoot object. Raises: NoSuchShadowRoot: If no shadow root was attached to element. Example: try: shadow_root = element

(self)

Source from the content-addressed store, hash-verified

280
281 @property
282 def shadow_root(self) -> ShadowRoot:
283 """Get the shadow root attached to this element if present (Chromium, Firefox, Safari).
284
285 Returns:
286 The ShadowRoot object.
287
288 Raises:
289 NoSuchShadowRoot: If no shadow root was attached to element.
290
291 Example:
292 try:
293 shadow_root = element.shadow_root
294 except NoSuchShadowRoot:
295 print("No shadow root attached to element")
296 """
297 return self._execute(Command.GET_SHADOW_ROOT)["value"]
298
299 # RenderedWebElement Items
300 def is_displayed(self) -> bool:

Callers

nothing calls this directly

Calls 1

_executeMethod · 0.95

Tested by

no test coverage detected