Unable to locate some elements in iOS (same elements can be found via Calabash)


#1

Our team recently updated our test framework from Calabash to Appium 1.10.0, and I was hoping someone could share some insights on a problem we’ve run into with accessing elements in our native iOS app via Appium. The app contains several views for which our accessibility team has specifically requested that only the main view be visible for accessibility purposes - for example, a view that contains separate subviews for an item’s color and size should be handled as a single swipe that reads off both text labels when navigating the app with VoiceOver. When using Calabash, we were able to locate all of the individual views by accessibility_id, but with the switch to Appium, we find that the subviews are not visible, and we can only select the ‘parent’ view.

Others have experienced the same issue with Appium, and the answer given previously was to make sure that the parent container view is NOT labelled as accessible, while the subviews are: https://github.com/appium/appium/issues/6517#issuecomment-298037046. This solution won’t work for us, as our accessibility team has requested that only the parent container be accessible.

Here is an example of the elements we see when viewing the app tree/source in Calabash vs. Appium (note - I am not able to share the actual app data - these are representative of what we’re seeing):

Calabash ‘tree’:

[UIView]
[UIView] [label: red, XL]
    [UIView]
    [UILabel] [id:color] [label:red] [text:red]
    [UILabel] [id:size] [label:XL] [text:XL]
    [UIImageView] [id:item_img]
    [UIView]

Appium ‘source’:

<XCUIElementTypeOther type="XCUIElementTypeOther enabled="true" visible="true" x="0" y="426" width="375" height="100">
    <XCUIElementTypeButton type="XCUIElementTypeButton" name="red, XL" label="red, XL" enabled="true" visible="true" x="0" y="456" width="375" height="121" />
    <XCUIElementTypeOther type="XCUIElementTypeOther enabled="true" visible="false" x="10" y="536" width="355" height="1"/>
</XCUIElementTypeOther>

As shown in the examples, Calabash allows us to access the individual elements (color, size, item_img), but these views are not found in the Appium XML source - only the parent node (XCUIElementTypeButton) is available in the page source.

We’re curious if anyone else has encountered a similar problem with Appium, and been able to come up with a solution. Unfortunately, I’m prevented from sharing code/logs by company policy, but please let me know if there’s any other information I can provide.


#2

I’ve been struggling with the same problem as some of the views in our app is a 3rd party API … I can see the elements but when I look at them in the inspector they are listed as visible = false … and my test fail. For now the styles are not going to change any time soon so I’m using tapat x y … this is working for the time being but would like the IDs to work properly.


#3

An update to provide some resolution - our app is highly accessible, and we found that the elements ‘hidden’ from appium were views that had been combined into a single swipe for voiceover screen-reading. The parent view (which voiceover was reading) could be seen by appium, but the sub-views could not.

We have worked with our developers to come up with a different solution for grouping views together for accessibility reasons. We still don’t have an answer to the original question of why these elements are visible to Calabash, but not to Appium, other than the obvious fact that the two different test frameworks are using different methods to inspect the elements.


#4

Check if allowInvisibleElements setting affects the visibility of these views


#5

Also ignoreUnimportantViews worth checking


#6

@cs if you have “button” element with other elements inside = you will not see anything inside. if it your case you can add to view accessibility elements but they will be outside button. we did it as workaround…

PS “XCUIElementTypeButton” ! i see it is in your example.