Unable to find webview context for Xamarin Forms (iOS) app

Hello, I’m not actually sure this a bug but I’m looking to understand what’s going on better. I’m on appium 1.20.2, running tests through Node.js against a Xamarin.Forms iOS app which has a screen with some native elements and a webview. The webview is debuggable through Safari’s remote debugger, and I can see traces in the appium logs which can see a web context, but are unable to match it with the running app:

debug] [RemoteDebugger] Current applications available:
[debug] [RemoteDebugger]     Application: "PID:54125"
...
[debug] [RemoteDebugger]         name: "WebViewComms.iOS"
[debug] [RemoteDebugger]         bundleId: "process-WebViewComms.iOS"
...
[debug] [RemoteDebugger]         pageArray:
[debug] [RemoteDebugger]             url: "https://www.google.com/"

[debug] [RemoteDebugger] Checking for bundle identifiers: com.apple.WebKit.WebContent, process-com.apple.WebKit.WebContent, process-SafariViewService, com.apple.SafariViewService, *, `com.dk.xam.WebViewComms`, com.apple.mobilesafari

The problem here is that RemoteDebugger looking for something called WebViewComms.iOS, when the bundleId of my app is actually com.dk.xam.WebViewComms, so it can’t match the PID hosting the webview to the app. If I change the app’s bundleId to match what RemoteDebugger is expecting, it works fine. I might be mischaracterizing the problem, but it seems like RemoteDebugger is mistakenly looking at the wrong field (bundle name). Since these two fields are often identical, maybe this is not often an issue?

1 Like