XCUIElementTypeToolbar disappears from the page source

I have a problem with test automation of my company app. We're using an external tool called Appium to automate our app, but under the hood it's using XCTest to obtain page source, and it looks like it might not work correctly, or we're doing something wrong.

The problem is that since iOS 16.4 XCUIElementTypeToolbar is completely disappearing from the page source XCTest provides to Appium. What's even stranger, it's working when the app is opened for the first time after the phone restart. But when the app is simply put to background and opened again, this toolbar is no longer recognizable and instead of having XCUIElementTypeToolbar with arrows up and down and "Done" button inside it, XCTest returns only XCUIElementTypeOther there with nothing inside. And the only thing to have it found again is to restart the phone. It's happening in WebView. We are aware that since iOS 16.4 inspectable for WebViews is turned off by default (link to docs), but we have it implemented, and it did not help.

It was working perfectly correct on iOS 16.3 and below, but completely stopped working on iOS 16.4 and above.

Do you have any ideas if it might be anything done incorrectly on our side, or it's maybe some kind of bug in XCTest?

It is possible that the toolbar no longer identifies as a XCUIElementTypeToolbar as of iOS 16.4 due to an OS change.

If you print the app.debugDescription during your test run, you can see what element types are available to interact with during your test.

XCUIElementTypeToolbar disappears from the page source
 
 
Q