Platform Context

In a hybrid mobile application, some pages are WebView and some pages are native. WebView allows you to display web content inside a native app. A WebView page leverages the device's browser engine to render HTML and process JavaScript locally. A native page is built with a platform SDK such as iOS or Android, using tools and languages for the specific platform.

Appium is an open-source tool for automating native, mobile web, and hybrid applications. Appium allows you to write tests against multiple platforms, such as iOS and Android, using the same API. For a hybrid mobile application test using Appium, the driver needs to enter the appropriate Appium context: WebView context for a WebView page or native context for a native page. For more details, see appium.io: Appium Context.

The platform field at the root of a page object defines the page context type. The value can be:

The UTAM framework uses the platform property to set WebView or native context at the page object bootstrap stage. Then, a test can interact appropriately with elements on the page.

Here's the JSON for a WebView page object (platform defaults to web):

{
    "selector": {
        "css": "div#main"
    },
    "elements": []
}

Here's the JSON for a native page object on Android:

{
    "platform": "native",
    "selector": {
        // native selector here
    },
    "elements": []
}