Navigation from mobile web tp app

Hi all,
The use case to automated is as following -

  1. User opens mobile web and navigates
  2. At some point user is redirected to mobile app and user continues operations on it
  3. In the end user is redirected back to mobile web

I thought of launching two different appium drivers one for mobile web and other for mobile app. However this approach does not work since 2 drivers have no context of each other. However I also cannot use same appium driver for both mobile web and app since either browserName or app are considered for creating driver -
https://appium.io/docs/en/writing-running-appium/caps/ that
``browserNameName of mobile web browser to automate. Should be an empty string if automating an app instead.
Has any one else come across this use case of dealing with both mobile web and app on one test?

You could start automation with capabilities for your app, then utilize Background App method and navigate to browser:

https://appium.io/docs/en/commands/device/app/background-app/

Once done, use mobile: activteApp (documented above) to bring app to foreground, or just navigate to icon and click it.

That would be my approach.