Skip to content

Commit

Permalink
Describe IME actions generation (#11436)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykola Mokhnach committed Sep 27, 2018
1 parent 17e1318 commit 04934fe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/en/writing-running-appium/android/android-ime.md
@@ -0,0 +1,24 @@
## How To Emulate IME Actions Generation

Very often Android developers use [onEditorAction](https://developer.android.com/reference/android/widget/TextView.OnEditorActionListener.html#onEditorAction(android.widget.TextView,%20int,%20android.view.KeyEvent)) callback with `actionId` argument to implement actions handling, for example, when `Search` or `Done` button is pressed on the on-screen keyboard. Appium since version 1.9.2 allows to automate the generation of such actions by providing the special `mobile:` command.


### mobile: performEditorAction

Executes the given editor action on the _currently focused_ element.

#### Supported arguments

* _action_: The name or an integer code of the editor action to be executed. The following action names are supported: `normal, unspecified, none, go, search, send, next, done, previous`. Read https://developer.android.com/reference/android/view/inputmethod/EditorInfo for more details on this topic.

#### Usage examples

```java
// Java
driver.executeScript("mobile: performEditorAction", ImmutableMap.of("action", "Go"));
```

```python
# Python
driver.execute_script('mobile: performEditorAction', {'action': 'previous'})
```
2 changes: 2 additions & 0 deletions docs/toc.js
Expand Up @@ -231,6 +231,8 @@ module.exports = {
["UiSelector Guide", "uiautomator-uiselector.md"],
["Android Code Coverage Guide", "android-coverage.md"],
["Activities Startup Troubleshooting Guide", "activity-startup.md"],
["How To Execute Shell Commands On The Remote Device", "android-shell.md"],
["How To Emulate IME Actions Generation", "android-ime.md"],
]],
["Other", ["other",
["Reset Strategies", "reset-strategies.md"],
Expand Down

0 comments on commit 04934fe

Please sign in to comment.