From 8a1994a10e7d32b5ec9dcf28d45e1d4f80c0c444 Mon Sep 17 00:00:00 2001 From: Diego Torres Milano Date: Mon, 26 Feb 2024 21:20:24 -0800 Subject: [PATCH] Add launcher drag example --- examples/helper/launcher-drag-youtube-icon.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/helper/launcher-drag-youtube-icon.py diff --git a/examples/helper/launcher-drag-youtube-icon.py b/examples/helper/launcher-drag-youtube-icon.py new file mode 100644 index 00000000..d8b5bc56 --- /dev/null +++ b/examples/helper/launcher-drag-youtube-icon.py @@ -0,0 +1,12 @@ +#! /usr/bin/env python3 + +from com.dtmilano.android.viewclient import ViewClient + +helper = ViewClient.view_client_helper() +oid = helper.ui_device.find_object(ui_selector="desc@YouTube").oid +t, l, r, b = helper.ui_object.get_bounds(oid=oid) +s_x = int(l + (r - l)/2) +s_y = int(t + (b - t)/2) +e_x = 300 +e_y = 700 +helper.ui_device.drag(s_x, s_y, e_x, e_y, 50)