Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[py] make relative_locator errors meaningful #11284

Merged
merged 1 commit into from
Nov 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions py/selenium/webdriver/support/relative_locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def below(self, element_or_locator: Union[WebElement, Dict] = None) -> "Relative
- element_or_locator: Element to look below
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling above method")
raise WebDriverException("Element or locator must be given when calling below method")

self.filters.append({"kind": "below", "args": [element_or_locator]})
return self
Expand All @@ -117,7 +117,7 @@ def to_left_of(self, element_or_locator: Union[WebElement, Dict] = None) -> "Rel
- element_or_locator: Element to look to the left of
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling above method")
raise WebDriverException("Element or locator must be given when calling to_left_of method")

self.filters.append({"kind": "left", "args": [element_or_locator]})
return self
Expand All @@ -129,7 +129,7 @@ def to_right_of(self, element_or_locator: Union[WebElement, Dict] = None) -> "Re
- element_or_locator: Element to look right of
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling above method")
raise WebDriverException("Element or locator must be given when calling to_right_of method")

self.filters.append({"kind": "right", "args": [element_or_locator]})
return self
Expand All @@ -141,7 +141,7 @@ def near(self, element_or_locator_distance: Union[WebElement, Dict, int] = None)
- element_or_locator_distance: Element to look near by the element or within a distance
"""
if not element_or_locator_distance:
raise WebDriverException("Element or locator or distance must be given when calling above method")
raise WebDriverException("Element or locator or distance must be given when calling near method")

self.filters.append({"kind": "near", "args": [element_or_locator_distance]})
return self
Expand Down