Skip to content

Commit

Permalink
[py] also clear w3c actions in ActionChains#reset_actions
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Tierney <[email protected]>
  • Loading branch information
lmtierney committed Jun 20, 2019
1 parent 34aedfe commit f61e76b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions py/selenium/webdriver/common/action_chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
15 changes: 14 additions & 1 deletion py/test/selenium/webdriver/common/interactions_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit f61e76b

Please sign in to comment.