Skip to content

Commit

Permalink
[rb] Removing browser filter when checking shadow root.
Browse files Browse the repository at this point in the history
Only Python had it, fixes #11893

During the meeting on [25.05.2023](https://www.selenium.dev/meetings/2023/tlc-05-25/)
it was decided add support for everything in spec and let
the drivers error when things do not work.
  • Loading branch information
diemol committed May 31, 2023
1 parent c1e47d3 commit d41e048
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions py/selenium/webdriver/remote/webelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,13 @@ def send_keys(self, *value) -> None:
@property
def shadow_root(self) -> ShadowRoot:
"""Returns a shadow root of the element if there is one or an error.
Only works from Chromium 96 and Firefox 96 onwards. Previous versions
of browsers will throw an assertion exception.
Only works from Chromium 96, Firefox 96, and Safari 16.4 onwards.
Previous versions of browsers will throw an assertion exception.
:Returns:
- ShadowRoot object or
- NoSuchShadowRoot - if no shadow root was attached to element
"""
browser_main_version = int(self._parent.caps["browserVersion"].split(".")[0])
assert (
self._parent.caps["browserName"].lower() != "safari"
), "This only currently works in Firefox and Chromium based browsers"
assert (
browser_main_version > 95
), f"Please use Firefox or Chromium based browsers with version 96 or later. Version used {self._parent.caps['browserVersion']}"
return self._execute(Command.GET_SHADOW_ROOT)["value"]

# RenderedWebElement Items
Expand Down

0 comments on commit d41e048

Please sign in to comment.