Skip to content

Commit 58872c6

Browse files
committed
[py] translate move_by_offset command to w3c
1 parent dce65ea commit 58872c6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

py/selenium/webdriver/common/action_chains.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,14 @@ def move_by_offset(self, xoffset, yoffset):
265265
- xoffset: X offset to move to, as a positive or negative integer.
266266
- yoffset: Y offset to move to, as a positive or negative integer.
267267
"""
268-
self._actions.append(lambda: self._driver.execute(
269-
Command.MOVE_TO, {
270-
'xoffset': int(xoffset),
271-
'yoffset': int(yoffset)}))
268+
if self._driver.w3c:
269+
self.w3c_actions.pointer_action.move_by(xoffset, yoffset)
270+
self.w3c_actions.key_action.pause()
271+
else:
272+
self._actions.append(lambda: self._driver.execute(
273+
Command.MOVE_TO, {
274+
'xoffset': int(xoffset),
275+
'yoffset': int(yoffset)}))
272276
return self
273277

274278
def move_to_element(self, to_element):

0 commit comments

Comments
 (0)