【问题标题】:Way to Automate button clicks of an Android Application自动化Android应用程序按钮点击的方法
【发布时间】:2015-03-12 10:35:27
【问题描述】:

有没有办法用一些脚本或android应用程序自动点击(打开,点击应用程序的某个按钮,最后关闭它)。

【问题讨论】:

    标签: android testing automation click


    【解决方案1】:

    取决于你想要做什么。对于您的应用程序的 UI 测试,您可以使用内置支持,查看 http://developer.android.com/training/activity-testing/activity-ui-testing.html 或者查看 UI automation tool

    如果您想要在任何给定应用程序上模拟用户事件,您可以使用 adb 发送按键或触摸事件,但这将是一个非常低的级别

    例如:

    adb shell input keyevent 3
    

    将模拟按 Home 键。

    你也可以

    adb shell input tap 50 50 
    

    在给定坐标处模拟触摸事件。

    【讨论】:

      【解决方案2】:

      您可以使用uiautomator(需要 API 16+)。

      Robotium(也使用Android testing framework)是另一个很棒的 UI 测试框架。 Espresso 也是如此。然后,您可以为您的应用编写 JUnit 3 测试。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-17
        • 2019-05-29
        • 2016-04-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多