标题中的问题。
我尝试过类似的事情:
onView(withId(R.id.search_edit_text))
.perform(typeText("some"), pressKey(KeyEvent.KEYCODE_ENTER));
但是它不起作用。键盘仍显示,未调用TextView.OnEditorActionListener
。有什么想法吗?
尝试
onView(withId(R.id.search_edit_text))
.perform(typeText("some"), pressImeActionButton());
我使用了KEYCODE_BACK,效果很好。 KEYCODE_ENTER无法在我的设备上运行SAMSUNG A70
onView(withId(R.id.edit_text).perform(ViewActions.pressKey(KeyEvent.KEYCODE_BACK))