iOS 13 returns different source tree structure as the view hierarchy.
Appium builds view hierarchy from accessibility snapshot. Users can search elements as XPath or class chain which find elements from the view hierarchy.
// Class Chain
@driver.find_elements :class_chain, 'XCUIElementTypeWindow['visible = 1]['name = "bla"']'
// XPath
@driver.find_element :xpath, '//*[@focused="true"]'
They depend on the view hierarchy. Thus, if the hierarchy changes, we must re-struct the path for the view.
We noticed it changes in iOS 13. With comparing iOS 12 and 13 with the same app, their structure was different in some views. Potentially, find element also changed since a view element have one item in iOS 12, but it has two items in iOS 13. The two items have same name, but different class type…
Appium simply parses all elements by XCTest framework. The behaviour depends on it… iOS 13 has a big change internally I assume since iPadOS appears.
In addition, Appium got includeNonModalElements setting. In some view such as nested modal presentations in iOS 13 cannot return all of elements as same as other views. Apple introduced a new private API to get them in Xcode 11 GM. The setting provides elements via it, but the elements possibly have wrong attributes. Thus, we also address shouldUseTestManagerForVisibilityDetection setting to alleviate the behaviour.
https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/settings.md
hm, they have big changes in iOS 13. happy testing.
[Update]
I found without includeNonModalElements was also able to get elements expectedly since Xcode 11.3 (11.2?) and iOS 13.2?. includeNonModalElements no longer worked…
Very complicated to handle running environment, but happy to fix the issue in XCTest side.