Currently there is one way to do so is sending the key event of the "Enter" key.
You cant get the android keys as element because UI Automator does not detects the buttons of the keyboard.
One Work Around to do exactly what you mentioned is presize tap on the "Done" button, but it won't be generic.(Avoid it)
Using the key event is the best and recommended way.