Skip to content

Commit da86c7f

Browse files
committed
[py] deprecate rather than deleting basic scroll action method
1 parent e1c8f7f commit da86c7f

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

py/selenium/webdriver/common/action_chains.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"""
1919
The ActionChains implementation,
2020
"""
21+
import warnings
22+
2123
from .actions.wheel_input import ScrollOrigin
2224

2325
from .utils import keys_to_typing
@@ -373,6 +375,26 @@ def scroll_from_origin(self, scroll_origin: ScrollOrigin, delta_x: int, delta_y:
373375
delta_y=delta_y)
374376
return self
375377

378+
def scroll(self, x: int, y: int, delta_x: int, delta_y: int, duration: int = 0, origin: str = "viewport"):
379+
"""
380+
Sends wheel scroll information to the browser to be processed.
381+
382+
:Args:
383+
- x: starting X coordinate
384+
- y: starting Y coordinate
385+
- delta_x: the distance the mouse will scroll on the x axis
386+
- delta_y: the distance the mouse will scroll on the y axis
387+
"""
388+
warnings.warn(
389+
"scroll() has been deprecated, please use scroll_to_element(), scroll_by_amount() or scroll_from_origin().",
390+
DeprecationWarning,
391+
stacklevel=2
392+
)
393+
394+
self.w3c_actions.wheel_action.scroll(x=x, y=y, delta_x=delta_x, delta_y=delta_y,
395+
duration=duration, origin=origin)
396+
return self
397+
376398
# Context manager so ActionChains can be used in a 'with .. as' statements.
377399

378400
def __enter__(self):

0 commit comments

Comments
 (0)