Cross-platform test between mobile and web app

Hi All,

Currently, I have an app that works on both Android and iOS. For some reason, i.e. authentication, I need to switch between the mobile app and the web page.

The workflow is simple: Run the app -> Click a button that opens the web page on the mobile app -> Add some data and click a button on the web page -> Return to the mobile app -> Continue to use the mobile app.

The beginning of the test works, but when I move to the web page, it stops working.

The idea that I have in mind is to instantiate a main driver for the mobile app (uiautomator2/xcuitest) and a secondary driver for the web (safari/chromium/gecko). So, I will switch between the drivers depending on the platform.

These are my questions before I start to dirt my hands:

  1. Is it feasible? Before starting to make big changes to my application, I would like to know that at least it works.
  2. If point 1, yes: is it the best solution available? I didn’t find options online on this issue, and it is a little bit strange. I am not inventing the wheel, and I think it could be a common issue between developers.

I am using the following drivers@versions:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

In most cases you should see web elements for debug builds that used for automartion. If NOT - ask DEV to make webViews debuggable.

Also can help enableMultiWindows setting for Android to see webView

Hi Aleksei, thanks for the reply and the advice.

Just to make sure I understood. If the mobile app has “setWebContentsDebuggingEnabled” plus “enableMultiWindows” in the appium, I could use the Android and iOS drivers to test the webpage without instantiating the additional driver for the web page.

Do you have a link where I could find an example?

No link. Just experience from all places I worked.

I found an alternative solution that works for both Android and iOS. I will text it so it can help others who face the same issue.

Appium-java-client provides this interface: SupportsContextSwitching, which allows the return of the list of contexts in the device. Switching between NATIVE_APP and WEBVIEW allows us to automate the app or the webview.