Issue with Visibility of IDs in iOS WebView in Appium Inspector

We are currently implementing end-to-end UI test automation for our hybrid app, which consists of both webview and native components. However, we’ve encountered an issue while validating the webview. Although our developer has assigned IDs to the elements, Appium Inspector shows that these IDs are recognized correctly on Android but not on iOS.

Does anyone know why this discrepancy occurs? While we are aware of the method to use aria-label to display as an Accessibility ID, we prefer to maintain consistency by using IDs across both platforms for testing purposes. Any alternative solutions or insights would be greatly appreciated!

I believe it is question to framework forum that uses developer to build app.

I am collaborating with developers to inject IDs into the desired elements, and I would like to find elements using a format like @iOSXCUITFindBy(id = "injected_id") to perform tests. However, I am encountering an issue where Appium Inspector does not recognize the injected IDs in the iOS app’s webview, which is causing difficulties. Could you please advise which forum or support channel I should post this issue to?

Can you find your ids using other inspectors? e.g. xCode inspector?

BTW Did you try switch to webView and now search elements like on web e.g. CSS selector?

Thank you for your response! When inspecting with Safari, the ID injected by the developer, which was not visible in the Appium Inspector, appeared correctly. However, after performing context switching (Oh, one more thing! When performing context switching, it only shows native_app and does not display the web view.
), I was continuously unsuccessful in locating the element using the ID identified via Safari Inspect. I will list the methods I have tried below. If there are better approaches or if I might have made any mistakes, please let me know.

IOSDriverManager.getDriver().findElement(By.id(“id”))
IOSDriverManager.getDriver().findElement(By.cssSelector(“#id”))
IOSDriverManager.getDriver().findElement(By.id(“#id”))

@FindBy(id = “#id”)
private WebElement idBtn;

@FindBy(xpath = “//*[@id="id"]”)
private WebElement idBtn;

@FindBy(xpath = “//button[@id="id"]”)
private WebElement idBtn;

@FindBy(css = “#id”)
private WebElement idBtn;

I’ve realized what the issue was! To address the Apple login bottom sheet, I intentionally did not include the bundleId in the driver settings, and it seems that this was preventing the context switch to the web view. Now that I’ve included the bundleId, the context switch to the web view works correctly, and the injected ID is also visible in the Appium Inspector! Now it looks like I just need to handle the Apple ID separately. Thank you for your help!

you see… nice your tries succeeded!