Unable to get available contexts in Hybrid iOS app

Hi everyone,

Given that I’m standing at a screen have WebView and Native context in iOS native app (I double checked that there is a WebView here by Safari develop mode)

I use this to get all available contexts, but only “NATIVE_APP” context is shown.
AppiumDriver<WebElement> driver = MobileDriverFactory.getDriver() Set<String> contextNames = driver.getContextHandles()

I did some research and find out that I need ios_webkit_debug_proxy to get WebView context. I set capacities startIWDP and autoWebview but still only show NATIVE_APP context.
In the log it shows: Failed to start ios_webkit_debug_proxy on default port 27753
Please help advice.
Thanks in advance,

Hi @baottran,

I’m not sure if you tried the Mobile.switchToWebView() function, but it might be what you need. You can check out another answer that worked for someone else trying to work with WebViews:

Hope this helps,