Reputation: 3969
Question in the title.
I tried something like:
onView(withId(R.id.search_edit_text))
.perform(typeText("some"), pressKey(KeyEvent.KEYCODE_ENTER));
But it doesn't work. Keyboard is still shown and TextView.OnEditorActionListener
not called. Any ideas?
Upvotes: 8
Views: 3159
Reputation: 1183
I used KEYCODE_BACK and it works well. KEYCODE_ENTER not working on my device SAMSUNG A70
onView(withId(R.id.edit_text).perform(ViewActions.pressKey(KeyEvent.KEYCODE_BACK))
Upvotes: 0
Reputation: 1164
Try
onView(withId(R.id.search_edit_text))
.perform(typeText("some"), pressImeActionButton());
Upvotes: 21