如何使用adb命令或类似方法在第三方应用程序上执行命令 [英] How to execute commands on a 3rd party app using adb commands or something similar

查看:82
本文介绍了如何使用adb命令或类似方法在第三方应用程序上执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用例,需要控制一个不是我开发的应用程序.我对Android设备具有adb访问权限.这些是必须执行的步骤:

I have a use case which requires an app, not developed by me, to be controlled. I have adb access to the android device. These are the steps that are required to be performed:

  1. 在两个字段中输入文字
  2. 按Enter
  3. 选择复选框
  4. 在另一个文本字段中输入文本
  5. 输入

我知道我可以使用 adb输入键事件<事件代码> adb输入键触摸板< x>< y> ,但是这些都是残酷的方法,不会每次都起作用.我已经研究了appium,但似乎仅限于移动Web应用程序.如果您自己构建了应用程序,则其他框架(例如Espresso)也可以使用.

I know I can use adb input keyevent <event-code> and adb input touchpad tap <x> <y>, but these are brutish methods that won't work every time. I have looked into appium, but it seems to be limited to mobile web applications. Other frameworks like Espresso work, if you've built the app yourself.

对于此问题,我找不到任何好的答案.非常感谢您的帮助!

I could not find any good answer to this problem. Any help is highly appreciated!

推荐答案

看看 UiAutomator .它将使您能够启动第三方应用程序并执行所需的任何操作.为了检查UI并创建正确的定位器,有一个名为uiautomatorviewer的命令行工具与Android SDK捆绑在一起.

Take a look at UiAutomator. It will enable you to launch a third-party app and perform any actions you want with it. In order to examine the UI and create the right locators, there's a command-line tool called uiautomatorviewer, bundled along with Android SDK.

这篇关于如何使用adb命令或类似方法在第三方应用程序上执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆