Nhat Nam Nhat Nam - 1 year ago 121
Android Question

Automate browser and native app

I want to use Appium to automate the scenario below on Android

  1. First open a web page in Chrome. The web page contains a
    registration form

  2. Fill the form then click the submit button

  3. The submit button open my native app via the uri (the same behavior
    as we open the Google Play by clicking on a link market://...)

  4. Finally interact with the app

I could make the automation for step 1 to 3 but stucked at step 4.

Is this possible with Appium? Is there any other testing framework which can automate the scenario like that?

Answer Source

It seems that the problem is related to changing from the webview context to the native app's own context. This is done in Java by using the command driver.context("NATIVE_APP");

To view all available contexts use driver.getContextHandles();, which returns a Set<String> with all available contexts.

Native context is always called "NATIVE_APP" and webviews usually are indexed as "WEBVIEW_0", "WEBVIEW_1" and so on.

All interactions to the app that are not related to a webview directly, will usually need to be done while in "NATIVE_APP" context.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download