Issue
How do you press the Editor Action key on Android softkey using Espresso? I tried:
onView(withId(R.id.edToNumber)).perform(typeText("MDO158"),ViewActions.pressKey(KeyEvent.ACTION_UP), closeSoftKeyboard())
Solution
To click the ActionDone button
from the keyboard of a Specific EditText, you could done by using this code:
onView(withId(R.id.edToNumber)).perform(typeText("MDO158");
onView(withId(R.id.edToNumber)).perform(pressImeActionButton());
Note:
pressImeActionButton()
not specifically used for click the ActionDone button
from the keyboard, it click whatever ActionButton
that the keyboard consist such as ActionDone
, ActionSearch
, ActionNext
, etc.
Optionally, you can close the keyboard of a Specific EditText without click the ActionDone button by using this code:
onView(withId(R.id.edToNumber)).perform(typeText("MDO158");
onView(withId(R.id.edToNumber)).perform(closeSoftKeyboard());
Answered By - I am a Student
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.