From f61e76bb591801bc8f2c6959aba100c6237133fc Mon Sep 17 00:00:00 2001 From: Lucas Tierney Date: Wed, 19 Jun 2019 20:09:18 -0500 Subject: [PATCH] [py] also clear w3c actions in ActionChains#reset_actions Signed-off-by: Lucas Tierney --- py/selenium/webdriver/common/action_chains.py | 2 ++ .../webdriver/common/interactions_tests.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/py/selenium/webdriver/common/action_chains.py b/py/selenium/webdriver/common/action_chains.py index d73003f4159c5..9d0a55b4e567f 100644 --- a/py/selenium/webdriver/common/action_chains.py +++ b/py/selenium/webdriver/common/action_chains.py @@ -88,6 +88,8 @@ def reset_actions(self): """ if self._driver.w3c: self.w3c_actions.clear_actions() + for device in self.w3c_actions.devices: + device.clear_actions() self._actions = [] def click(self, on_element=None): diff --git a/py/test/selenium/webdriver/common/interactions_tests.py b/py/test/selenium/webdriver/common/interactions_tests.py index f7e9cb50ec63d..0a2908b21088c 100644 --- a/py/test/selenium/webdriver/common/interactions_tests.py +++ b/py/test/selenium/webdriver/common/interactions_tests.py @@ -230,7 +230,20 @@ def testCanSendKeysBetweenClicks(driver, pages): def test_can_reset_interactions(driver, pages): - ActionChains(driver).reset_actions() + actions = ActionChains(driver) + actions.click() + actions.key_down('A') + if driver.w3c: + assert all((len(device.actions) > 0 for device in actions.w3c_actions.devices)) + else: + assert len(actions._actions) > 0 + + actions.reset_actions() + + if driver.w3c: + assert all((len(device.actions) == 0 for device in actions.w3c_actions.devices)) + else: + assert len(actions._actions) == 0 def test_can_pause(driver, pages):