Skip to content

Commit

Permalink
Remove redundant scroll_to in click method
Browse files Browse the repository at this point in the history
Webdriver by default scrolls to element before
click.

See spec:
https://www.w3.org/TR/webdriver2/\#element-click
  • Loading branch information
M1troll committed Jun 25, 2024
1 parent 76ce2df commit 28ee782
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Version history

We follow `Semantic Versions <https://semver.org/>`_.

0.7.5
*******************************************************************************
- Remove redundant call of ``scroll_to`` in ``PomcornElement.click()``.
This is redundant, as webdriver by default scrolls to element before click (`docs <https://www.w3.org/TR/webdriver2/#element-click>`_).

0.7.4
*******************************************************************************
- Improve ``Page.click_on_page()`` method to click the page coordinates instead
Expand Down
4 changes: 0 additions & 4 deletions pomcorn/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,21 +285,17 @@ def select(self, value: str, only_visible: bool = True):
def click(
self,
only_visible: bool = True,
scroll_to: bool = True,
wait_until_clickable: bool = True,
):
"""Click on element.
Args:
only_visible: Flag for viewing visible elements. If this is `True`
(default), then this method will only get visible elements.
scroll_to: Whether to scroll to element before clicking or not.
wait_until_clickable: Wait until the element is clickable before
clicking, or not (default `True`).
"""
if scroll_to:
self.scroll_to(only_visible=only_visible)
if wait_until_clickable:
self.wait_until_clickable()
self.get_element(only_visible=only_visible).click()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pomcorn"
version = "0.7.4"
version = "0.7.5"
description = "Base implementation of Page Object Model"
authors = [
"Saritasa <[email protected]>",
Expand Down

0 comments on commit 28ee782

Please sign in to comment.