iOS - Detecting buttons that are initially hidden in a table view cell


I have an iOS app and a screen with a table view. Each table view cell has a button that when tapped expands the cell and shows some further buttons inside another another view (this view is initially hidden). I’m unable to see the hidden buttons in appium after tapping to expand the hidden content, even though it’s visible on screen. I’ve set the accessibilityIdentifier’s on each hidden button but appium is not able to see them even (I’ve tried setting it in XCode Interface Builder and in code). In appium desktop it only shows XCUIElementTypeOther even after I click on the Refresh Source button.

If I configure the table view such that the cells are always expanded then the buttons are picked up correctly in Appium, but that’s not how the app should work.

Is there anything else I can do to let appium see these buttons after I’ve expanded a table view cell? Unfortunately I can’t test the functionality related to these buttons otherwise

Can you see these buttons in xCode layout inspector?

Hi, when the hidden content is collapsed they don’t appear in the debug view hierarchy. But if I expand them and then tap on the view hierarchy button to inspect the layout they are there correctly.

When collapsed I can see this:

And expanded I can see this (in my code I’m changing the .isHidden property of the UIStackView to show and hide it)

did you try to see them in



Unfortunately I can’t see them - after I expand the content I’ve tried waiting 10 seconds and then calling getPageSource, but it doesn’t show them. Below is a snippet from the getPageSource result showing the table view cell I think:

I notice that the bottom XCUIElementTypeOther does have a height of 50 so maybe it’s recognised that this has expanded, but unfortunately it doesn’t seem to find any labels or buttons

i had similar problems with our app. to solve them asked developers to make elements inside CELL or Button (quite common problem both) accessible.

in code it looks like in Button/Cell class we add line:

accessibilityElements = [element_1, element_2, element_3]

also sometimes it is needed it to “init” function on View.

just in general how our iOS developers do this. after this elements appearing a bit in different place in page source BUT anyway we can work with them.

Thank you, I’ll have a look at that!

Thank you Aleksei, that worked for me! I can see and access in Appium the buttons I need in the expanded section. Thanks for your help!