Skip to content

Commit b00ca92

Browse files
committed
Add ui_device drag
1 parent 33c6f40 commit b00ca92

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/com/dtmilano/android/uiautomator/uiautomatorhelper.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,22 @@ def click(self, x: int, y: int):
449449
"""
450450
check_response(self.uiAutomatorHelper.api_instance.ui_device_click_get(x=x, y=y))
451451

452+
def drag(self, start_x: int, start_y: int, end_x: int, end_y:int , steps: int) -> None:
453+
"""Performs a swipe from one coordinate to another coordinate.
454+
455+
Performs a swipe from one coordinate to another coordinate. You can control the smoothness and speed of the
456+
swipe by specifying the number of steps. Each step execution is throttled to 5 milliseconds per step,
457+
so for 100 steps, the swipe will take around 0.5 seconds to complete.
458+
459+
:see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml
460+
:param int start_x: from x (required)
461+
:param int start_y: from y (required)
462+
:param int end_x: to x (required)
463+
:param int end_y: end y (required)
464+
:param int steps: is the number of move steps sent to the system (required)
465+
"""
466+
check_response(self.uiAutomatorHelper.api_instance.ui_device_drag_get(start_x, start_y, end_x, end_y, steps))
467+
452468
def dump_window_hierarchy(self, _format='JSON'):
453469
"""
454470
Dumps the window hierarchy.

0 commit comments

Comments
 (0)