diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index a85e565..693bbd7 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -3,6 +3,12 @@ Version history We follow `Semantic Versions `_. +0.7.4 +******************************************************************************* +- Improve ``Page.click_on_page()`` method to click the page coordinates instead + of offset relative to current mouse position + + 0.7.3 ******************************************************************************* - Add ability to not specify ``app_root`` in ``Page.open_from_url()`` as in ``Page.open()`` diff --git a/pomcorn/page.py b/pomcorn/page.py index e8bc04f..4ecc465 100644 --- a/pomcorn/page.py +++ b/pomcorn/page.py @@ -153,25 +153,19 @@ def navigate_relative(self, relative_url: str = "/") -> None: ) def click_on_page(self) -> None: - """Click on (1, 1) coordinates of `html` tag (page upper left corner). + """Click on (1, 1) coordinates of page (left upper corner). Allows you to move focus away from an element, for example, if it is currently unavailable for interaction. """ - from selenium.webdriver.common.action_chains import ActionChains - - from pomcorn import locators - - html_webelement = self.init_element( - locator=locators.TagNameLocator("html"), - ).get_element() + from selenium.webdriver.common.actions.action_builder import ( + ActionBuilder, + ) - ActionChains(self.webdriver).move_to_element_with_offset( - to_element=html_webelement, - xoffset=1, # cspell:disable-line - yoffset=1, # cspell:disable-line - ).click().perform() + action = ActionBuilder(self.webdriver) + action.pointer_action.move_to_location(1, 1).click() + action.perform() @staticmethod def _get_full_relative_url(app_root: str, relative_url: str) -> str: diff --git a/pyproject.toml b/pyproject.toml index 5d9ab7b..a5bcd39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pomcorn" -version = "0.7.3" +version = "0.7.4" description = "Base implementation of Page Object Model" authors = [ "Saritasa ",