I can't get Appium Inspector Working with iOS 17 WebView

Hi I am trying to access elements in Appium Inspector version 2024.2.2 my system is on Appium version 2.5.1, and XCUItest Driver version 7.1.0.
I am not able to inpect my application when running on webview with simulator version 17, I am able to inpect same url when running it on simulator version 16.4 irrespective of isInspectable property Appium Inspector keeps loading but didnt load anything.

Please provide server log.

Server Logs.txt (18.6 KB)

Ok, I’m going to post the problems I’m seeing and comment. I’ll also post some resources for you to follow up on:

Consider adding the “app:” capability with a path to your executable. This will make things run smoother and faster.

Consider adding “platformVersion:” capability unless you enjoy inconsistent driver behavior (which is what I think you are experiencing).

You don’t really need to declare “udid:” capability with Simulator. Consider not using this capability.

Consider adding “platformVersion:” capability and specifying iOS version that you are testing in this capability. I also note here that with Xcode 15 (according to your log) you should probably not go higher than iOS 17.0. For your reference:

Here is a good tutorial on using the Appium Inspector:
Only thing I would ignore is using the GUI Server, which at this point is obsolete. Otherwise, this is a good reference.

And here is the command reference for Appium Capabilities, in case you have questions about which ones you might need going forward:

Good luck to you. I think with some slight corrections to your configuration you should be able to get things up and running as you would like.

Hi I have updated the capabilities as you suggested with following but no luck, I am still not able to get view hierarchy following are the updated capabitities along with server Logs

  "platformName": "iOS",
  "appium:platformVersion": "17.0",
  "appium:deviceName": "AppiumSim17",
  "appium:app": "/Users/lakahaya.chhabra/Documents/Appium/iOS/WebApp/WebView.app",
  "appium:automationName": "XCUITest"

appiumlogs.txt (104.0 KB)

I’m seeing timeout getting page source. App name seems generic, is this a publicly available app?

No its a debug app, my question is its working fine with iOS 16 Simulator only problem with iOS 17 Simulator, that should not be the case right.

Yeah, that’s right. There is a timeout from getting page source, could try to increase that timeout with newCommandTimeout capability. I also saw in that log a build failure with Xcode error 75. Are the two simulators run on the same Mac?

Yes both are on same mac everything is same, I will try to update the timeout & also let me check error 75, will get back to you with update on same.

Hi I have tried to double the timeout and all still no luck here is the updated Server Logs.
Appium_Server_logs.txt (48.1 KB)

That log is interesting. The timeout seems to not use the value you pass as a timeout capability. Could you try with capability, “wdaConnectionTimeout”, and pass the value as an integer instead of a string? So:

"appium:wdaConnectionTimeout": 7200 # <- not "7200"

Current error is at 240000ms, so you may need to bump that value up, especially if it’s in milliseconds. I’d like to see the value in this error change according to the value that you have set:

[XCUITestDriver@80f7 (c08262d9)] AxiosError: timeout of 240000ms exceeded

For reference I’m looking at this bug, which is slightly different, but may have some value for this:

Hey, Lakshya.
Did fixed this issue? Am getting same error while inspecting 17+ ios;

Hi @Sai_q and @Lakshaya
not sure if this issue has been resolved on your side guys.

But i worked with our dev and checked first with safari web inspector and it didn’t work, so we checked the code and updated react-native-webview to the latest & added this capability (webviewDebuggingEnabled ) & took the build & it started working Seems nothing wrong with Appium but its related to the AUT. Hope this helps.

it worked on - iOS 17.4

1 Like

Hi @wreed & @mykola-mokhnach
In my last comment I mentioned it worked but via appium inspector I am able to switch to webview and can interact with elements in appium inspector too but while I am running my script getContextHandles returning just NATIVE_APP,
I am struggling on why it’s not returning WEBVIEW context, initially I was on Java Appium client 8 & Selenium 4 but after reading quite a few articles , I got to know it’s working for Appium Java client 9.0.0 with Selenium 4.15.0
Appium Java client with Selenium 4.21.0
Tried with different appium Java client & Selenium compatible combinations, Not sure what’s the issue. Tried changing quite a few versions but no luck

Set<String> contextNames = ((SupportsContextSwitching) driver).getContextHandles();
        for (String contextName1 : contextNames) {
            System.out.println(contextNames); //prints out something like NATIVE_APP \n WEBVIEW_1

above code just returns NATIVE_APP, I am expecting it should return WEBVIEW_ context too.

I would make sure you have latest java client. Please use the compatibility matrix here to determine what selenium version to use:

Otherwise I’m not sure. I’m not currently working with an app that has webview. If you post a log I’ll have a look at it.

1 Like