docs: mobile:getContexts for Android (#14765)

This commit is contained in:
mwakizaka
2020-10-01 09:31:20 +02:00
committed by GitHub
parent a29f545a78
commit bd20249ff5
2 changed files with 5 additions and 5 deletions
@@ -8,11 +8,10 @@ description:
For information on the format of the context names, see the [get context
documentation](/docs/en/commands/context/get-context.md).
On iOS, using the XCUITest driver, one can use the `mobile: getContexts`
[mobile command](/docs/en/commands/mobile-command.md) as an alternative to
the standard method in order to get the title and url associated with each
context as additional metadata.
[mobile command](/docs/en/commands/mobile-command.md)
`mobile: getContexts` is available on iOS (XCUITest) and Android
(UIAutomator2 and Espresso) to get more detailed contexts.
For information on contexts, see Appium's [hybrid automation docs](/docs/en/writing-running-appium/web/hybrid.md).
example_usage:
+1
View File
@@ -83,6 +83,7 @@
| mobile:deleteFile | Delete a file on the device under test. The remote path value should be the full path or a file inside an application bundle. | `{remotePath}` | `{remotePath: '@io.appium.example/path/in/bundle'}`, `{remotePath: '/tmp/data/file'}` |
| mobile:startService | Starts the given service by calling `am start-service` or `am start-foreground-service` under the hood since Appium 1.18.0. The `intent` argument is mandatory. `user` is the ID of the user the service should be started for (the current user ID is used by default). If `foreground` is set to `true` then the service will be started in foreground. | `{intent, user, foreground}` | `{intent: 'my.app/my.activity', foreground: true}` |
| mobile:stopService | Stops the given service by calling `am stop-service` under the hood since Appium 1.18.0. The `intent` argument is mandatory. `user` is the ID of the user the service should be stopped for (the current user ID is used by default). | `{intent, user}` | `{intent: 'my.app/my.activity'}` |
| mobile:getContexts | Retrieve available contexts, along with details associated with each webview (see [get contexts](/docs/en/commands/context/get-contexts.md)) in JSON structure. The details of each webview includes such as android package name and its window handles details (see [get handles](/docs/en/commands/web/window/get-handles.md)). The details of each window handle (which donated as `pages` in the JSON) contains such as url, title and id. The id is part of a window handle name. Therefore, by concatenating a string like "CDwindow-" + id, you can use the string for switching to window (see [set window](/docs/en/commands/web/window/set-window.md).) | | |
### Android (UiAutomator2 only)
| Command | Description | Argument | Argument Example |