【问题标题】:How to simulate touch events on Android device?如何在 Android 设备上模拟触摸事件?
【发布时间】:2015-11-01 20:51:09
【问题描述】:

Android API 是否公开了用于生成触摸事件的工具,例如,在屏幕上重复模拟不同的手势以进行测试?

【问题讨论】:

    标签: android api simulation gesture multi-touch


    【解决方案1】:

    adb 命令对你有用还是你需要某种蒙凯测试工具命令???

    对于 adb 命令,您可以使用以下 shell 命令...

    adb shell 输入 tap x y 和

    adb shell 发送事件 /dev/input/event0 3 0 5 adb shell 发送事件 /dev/input/event0 3 1 29 adb shell 发送事件 /dev/input/event0 1 330 1 adb shell 发送事件 /dev/input/event0 0 0 0 亚行外壳发送事件/dev/input/event0 1 330 0 adb shell 发送事件 /dev/input/event0 0 0 0

    【讨论】:

    • 您找到最佳解决方案了吗?如果你找到了,请在此处更新或接受一些答案,以便其他人也知道答案。
    【解决方案2】:

    您可以编写一个 Android Instrumention Test 来在 android 中实现 UI 自动测试,请参阅 Tesing UI for a Single ActivityAndroid Testing Support Library

    如果您是 Android Test 新手,建议您先阅读Activity Testing

    【讨论】:

    • 它是否适用于任何应用程序,甚至在当前应用程序之外?有没有使用示例?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-02
    • 2012-02-16
    • 1970-01-01
    • 2019-05-01
    • 1970-01-01
    相关资源
    最近更新 更多