-2

I want to use adb command to create something like auto-click in app. Before i ask this question, i have tried selenium and appium. None of them could solve my problem. This app is so strange, it would not allow you to find UI element when you do one hundred clicks. Therefore, I can only try to use adb command to implement my project.

In this app, you could only see three card-boxes on the entire screen. Each card-box has exactly same width and height with a space between each card-box. Only you scroll up, then the next card-box could pop up.
I want to perform a exactly scroll-chain effect like using finger. There is not overscroll when you use finger to press the screen, drag up or down and then lift up your finger.

I test some code like adb shell input swipe {x1} {y1} {x1} {y1 + y} {duration}, but could not implement that effect i have told.
The problem is that i only want exactly scroll distant with adb cammand, then each time i could exactly tap the first card-box.

I test my code in python with some constraints.
1.Using Appium is not allowed.
2.Using Selenium is not allowed.

Are there any other solutions?

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Jun 28 at 17:19

1 Answer 1

0

One of the AndroidViewClient/culebra examples is precisely a drag & drop operation, not exactly using adb but close.

I leave the source here as it's simple

#! /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)

but you can also find it here.

The screencast to see it in action is also available at launcher-drag-youtube-icon.gif (too big to upload here).

Not the answer you're looking for? Browse other questions tagged or ask your own question.