Skip to content

Commit 4ec2ca9

Browse files
committed
FIX: Make sure multiple clicks are on the same ActionChain.
1 parent 736f379 commit 4ec2ca9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

botcity/web/bot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,16 +830,17 @@ def click_at(self, x, y, *, clicks=1, interval_between_clicks=0, button='left'):
830830
button (str, optional): One of 'left', 'right'. Defaults to 'left'
831831
"""
832832
self.mouse_move(x, y)
833+
ac = ActionChains(self._driver)
833834
for i in range(clicks):
834-
ac = ActionChains(self._driver)
835835
if button == 'left':
836836
ac.click()
837837
elif button == 'right':
838838
ac.context_click()
839839
else:
840840
raise ValueError('Invalid value for button. Accepted values are left or right.')
841-
ac.perform()
842-
self.sleep(interval_between_clicks)
841+
ac.pause(interval_between_clicks/1000.0)
842+
ac.perform()
843+
843844

844845
@only_if_element
845846
def click(self, wait_after=config.DEFAULT_SLEEP_AFTER_ACTION, *,

0 commit comments

Comments
 (0)