small medium large xlarge

07 May 2013, 19:00
Bernard Farrell (13 posts)

If you enable the Accessibility Inspector on the iPad it will help you identify screen elements.

Go to General->Accessibility and turn the inspector on. A small colored dialog will appear that is always above the rest of the screen.

The inspector works while the dialog is expanded. You can press the X on the upper left of the window to enable and disable it.

When it’s enabled all presses seem to be disabled. Instead when you press on an element you’ll see the following information

Label. Example Menu Items

# Traits. Examples “Static Text” or Button # Frame. Example {{349, 556}, {22,375}}

You can use the Label value to search for items using searchWithPredicate(). Unfortunately the values can’t be copied from the inspector pane.

This has helped me greatly when identify things I want to tap or confirm.

07 May 2013, 23:47
Jonathan Penn (43 posts)

Yup, that’s a great idea! I was torn about putting that in the book or not. Since you can use the capture functionality and log element tree within UI Automation to poke around, too, I decided against it. Or, my editor advised me against putting in too much. :)

08 May 2013, 13:36
Bernard Farrell (13 posts)

One challenge for me is that the trace output is always exported as XML and there are a lot of elements in any app.

It’s not easy to view the .plist/XML in a readable way, opening it in a browser works but there’s a lot of extraneous elements. Using the Accessibility Inspector lets me focus on just the elements I need to know about.

08 May 2013, 18:02
Jonathan Penn (43 posts)

Ah, I see what you’re talking about. In the book, I avoid that problem by leading the reader through using the Instruments GUI and working with tests in the JavaScript editor of UI Automation. Yeah, browsing through the plist isn’t the easiest solution.

Thanks for sharing what you find!

  You must be logged in to comment