【问题标题】:Send complex swipes to Android with Adb/Python (no sendevent)使用 Adb/Python 向 Android 发送复杂的滑动(无 sendevent)
【发布时间】:2022-10-13 02:04:59
【问题描述】:

我正在尝试自动化我的android手机上的一些应用程序,我需要从A点(140、950)滑动到B点(140、1200),然后再到C点(400、1200)而不释放。

而且我已经尝试过输入滑动

adb shell "input touchscreen swipe 126 459 413 472 & input touchscreen swipe 413 472 407 769" 但这会导致同时执行 2 次滑动,而不是连续执行。

Sendevent 需要 root 访问权限

AppiumRobotiumMonkeyrunner 不是解决方案,因为我不是在测试自己的应用程序,而是想自动化现有的应用程序。

由于scrcpy 设法发送此类输入,因此可能有 adb 的非 root 解决方案,但我无法理解源代码

谢谢!

【问题讨论】:

标签: python android adb


【解决方案1】:

您可以使用AndroidViewClientCulebraTester-public刷卡像这样。

#! /usr/bin/env python3

from com.dtmilano.android.viewclient import ViewClient
from culebratester_client.models import Point

helper = ViewClient(*ViewClient.connectToDeviceOrExit(), useuiautomatorhelper=True).uiAutomatorHelper

# assume google keep is open
helper.ui_device.swipe(segments=[Point(140, 950), Point(140,1200), Point(400, 1200)], segment_steps=100)

使用Google Keep 作为可以绘制的应用程序示例,并且我们从您的问题中得到相同的点

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-22
    • 1970-01-01
    • 2013-10-31
    • 1970-01-01
    相关资源
    最近更新 更多