在 Nexus 7 平板电脑上搜索内容时,我无法按“开始”按钮。对于键盘上的“开始”按钮,我们没有任何文字或内容描述。我尝试使用以下 -
//Search something say "fun"
new UiObject(new UiSelector().text("Enter URL or Search & Win")).setText("fun");
getUiDevice().pressEnter();
OR
getUiDevice().pressSearch();
Also tried :
getUiDevice().pressKeyCode(66); //for enter
getUiDevice().pressKeyCode(84); // for search
但这行不通。 谁能帮我解决这个问题。
谢谢
最佳答案
尝试引用索引使用按钮属性。
即:
UiObject cancelButton = new UiObject(new UiSelector().className("android.widget.Button"));
关于java - 使用 Android UI Automator 按键盘的 'Go' 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17525429/