使用 uiautomator for Android 我可以在文本字段中设置文本,但无法关闭键盘。在某些手机处于横向模式时,键盘会占据整个屏幕,必须点击“完成”才能退出该视图。如果我可以抑制键盘,那么我可以在横向和纵向中运行 uiautomator 而不会出现问题。
new UiObject(new UiSelector().text("Enter Text")).click();
new UiObject(new UiSelector().className("android.widget.EditText").instance(0)).setText("sample text");
// This is where I need to suppress the keyboard to view the app instead of just the keyboard itself.
new UiObject(new UiSelector().text("Submit")).click();
提前致谢。