Unable to switch back to native app after clicking on email verification link

I have a scenario where i need to send verification email in order to complete sign in process. I am retrieving this link via API call and try to open this link in chrome browser it is throwing me below mentioned error:

*** selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error attempting to start URI. Original error: Error: Starting: Intent { act=android.intent.action.VIEW dat=https://appname.page.link/.… pkg=com.appname.xyz.dev } Error:

Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=https://Appname.page.link/.… flg=0x10000000 pkg=com.appname.xyz.dev }

Note: we had to amend the originally received URL by replacing some unwanted special character in order to navigate correct screen.
I suppose it’s an issue with context switching

@Aleksei any suggestion

First try use pure POST api call - easiest. Try with any tool e.g. Postman to open this link. If it works write api call code. In such case no browser needed.

Otherwise (often real browser needed) open in code browser, put needed url and go. I do similar in Safari browser. Tests running on macMini.

We are able to open the URL received from API response manually. it’s working fine.
When we try to open it in chrome browser it’s not navigating back to app, instead it’s navigating back to Playstore.
Also I suppose it’s using chrome browser internal WebViews to open the link

When we are using below mentioned capabilities:

setWebContentsDebuggingEnabled: true
autoWebview: true
autoWebviewTimeout: “20000”

It shows error no webview is found
while without these capabilities it shows both Web context in Array.

@Aleksei Thanks for your help, Issue is resolved by using deep link approach.