如果我正在测试应用程序,请在 android/adb shell 中使用 am start 命令。 并且该应用程序要求用户在继续主要内容之前登录。 如何使用 am start 命令从 android 命令行登录应用程序。
我不了解如何从 shell/am start 命令访问这些表单字段。
最佳答案
Alex 的回答很好,我放弃了。更加具体。这是我的一些代码在你的 am start 命令之后。
adb shell input keyevent 20 # or 61 for TAB, you might need to do more than once
adb shell input text "myusername"
adb shell input keyevent 66 #or 61 for TAB
adb shell input text "mypassword"
adb shell input keyevent 66 # or 61 to tab to the login button then add a 66
我的问题是我必须先让屏幕聚焦才能使这段代码正常工作。我必须触摸一次屏幕,然后代码就可以了。否则它有时会起作用,但有时会不起作用。
我不知道什么代码可以实现“聚焦”功能。低级触摸事件会起作用,但不同的android版本不同,所以我不想使用它。
关于android-intent - 使用 am start 命令从 adb shell 登录应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14093808/