问题
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:
- Input text in two fields
- Press Enter
- Select checkboxes
- Enter text into another text field
- Enter
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!
回答1:
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.
来源:https://stackoverflow.com/questions/63295856/how-to-execute-commands-on-a-3rd-party-app-using-adb-commands-or-something-simil