Skip to content

Commit

Permalink
[py] Removing browser filter when checking shadow root. (#12122)
Browse files Browse the repository at this point in the history
* [rb] Removing browser filter when checking shadow root.

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.

* [rb] Addressing PR comments
  • Loading branch information
diemol authored May 31, 2023
1 parent c1e47d3 commit 018293f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions py/selenium/webdriver/remote/webelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,12 @@ 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.
: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 018293f

Please sign in to comment.