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

Finding Elements in the New Idiom

Now that we’ve seen how NearbyMe changed to take advantage of the larger iPad screen, how has the element tree changed? Whenever we’re faced with new interface designs to test, it’s good to do some exploration and then pull the results out into our toolbox as we see fit. Let’s try finding the list of search terms on the iPad and tapping one.

Make sure that Xcode is building for the iPad simulator and press -I to build and launch the app in Instruments. If the simulator was already running, make sure it is in portrait orientation.

Enter this script into the UI Automation instrument to try and tap the search term “coffee”:

06-Universal/step01/automation/sandbox.js
 
"use strict"​;
 
 
var​ target = UIATarget.localTarget(); ...

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