O'Reilly logo

Test iOS Apps with UI Automation by Jonathan Penn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Identifying Elements with Accessibility APIs

Our test works fine for the moment, but we have a fragile situation on our hands. As we see in Figure 26, Finding the map pins in the window, the pin annotation views are represented as just plain UIAElement instances. Although we’re able to use the special filtering methods such as buttons and cells to fetch only elements of a certain type, we don’t have that convenience here. We have to use the generic elements method.

This could be a problem if we were testing for a pin with the name Legal, for instance, because the static text element for the Map Kit legal disclaimer has that name and is a sibling in the element array, along with all our pins. This could give us a false positive in a test. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required