Access to hidden elements on iOS

Hi Guys,

We are doing some automation for a native app with a map. The customer wants to add some information to hidden labels on the view at runtime, so we can read some info about the map.

Anyone know how they can hide these labels but keep them accessible to appium? When they make them hidden, or set the height of the labels to 0, we can no longer see them in the inspector.

Anyone got some good tips for such a scenario?


One way I’ve done this is to append Strings to the end of accessibility Identifiers, and then if such and such id is visible, do some action/condition.

@dem0n0cracy thanks for the reply. Their goal is to have hidden labels in which they can put lat and long coordinates. The labels have accessibility identifiers, but they don’t want these labels to be visible on the app - they are solely for passing this info to the appium automation scripts.

The problem is that hiding them, means appium can’t see them. Is there a way we can hide these labels from the user, but have them still accessible (for appium)

Make sense?


AccessibilityLabel = voiceover text

AccessibilityIdentifier = secret id that only appium can see.

But, I guess the problem is that you’d have to know beforehand what the lat/long is. In my case, I was changing the A_ID for a uiView that contains an image, and changing it based on what entitlement my account has. (NavBar-TitleImageView-FreeAcct vs NavBar-TitleImageView-PlusAcct) But here, you wouldn’t know what id to expect because it’s just a random number.

There are definitely ways to have hidden elements show up in appium that you can pull information out of, but I’m not exactly sure. Maybe they could have super small elements that have visible textboxes that are rendered, but so small they don’t appear - like a pixel basically with text in it.