From bd20249ff5d21e09e0fe7bcf1ba2c80229dea10b Mon Sep 17 00:00:00 2001 From: mwakizaka Date: Thu, 1 Oct 2020 16:31:20 +0900 Subject: [PATCH] docs: mobile:getContexts for Android (#14765) --- commands-yml/commands/context/get-contexts.yml | 9 ++++----- commands-yml/commands/mobile-command.yml | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/commands-yml/commands/context/get-contexts.yml b/commands-yml/commands/context/get-contexts.yml index 7cdaaa1a9..7e6efb2d5 100644 --- a/commands-yml/commands/context/get-contexts.yml +++ b/commands-yml/commands/context/get-contexts.yml @@ -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: diff --git a/commands-yml/commands/mobile-command.yml b/commands-yml/commands/mobile-command.yml index c1e84134e..b85e2fcab 100644 --- a/commands-yml/commands/mobile-command.yml +++ b/commands-yml/commands/mobile-command.yml @@ -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 |