Skip to content

Commit

Permalink
Add pause to action chains
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Sep 1, 2017
1 parent abe4ec4 commit d3f9b1f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions py/selenium/webdriver/common/action_chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"""
The ActionChains implementation,
"""

import time

from selenium.webdriver.remote.command import Command

from .utils import keys_to_typing
Expand Down Expand Up @@ -311,6 +314,16 @@ def move_to_element_with_offset(self, to_element, xoffset, yoffset):
'yoffset': int(yoffset)}))
return self

def pause(self, seconds):
if self._driver.w3c:
self.w3c_actions.pointer_action.pause(self, seconds * 1000)
self.w3c_actions.key_action.pause(self, seconds * 1000)
else:
self._actions.append(lambda: self._driver.execute(
time.sleep(seconds)
))
return self

def release(self, on_element=None):
"""
Releasing a held mouse button on an element.
Expand Down

0 comments on commit d3f9b1f

Please sign in to comment.