I'm in the process of automate one of my apps.
First I tap on a tabBar =>ok
Tap on a 'Add' button of a navigation bar => ok
Fill some data of my textFields of my tableView => ok
Tap on some cell and open a new ViewController => ok
Tap on a 'Add' button in this new controller => nothing happens ...
The button is the same as the first view: UIBarButtonSystemItemAdd
So, now I want to show all the buttons that automation can find, and iterate and get their names, just to check that all is going well, but I can't find the name of the buttons, see:
var arr = UIATarget.localTarget().frontMostApp().navigationBar().buttons();
for(var i=0; i<arr.length; i++) {
var value = arr[i];
UIALogger.logMessage(value.name);
}
And I'm tapping both buttons the same way:
UIATarget.localTarget().frontMostApp() .navigationBar().buttons()["Add"].tap();
thanks,
r.
EDIT:
Ok, the button tap has been solved using a delay of 1
But I can't get the button names in the loop, but at least I can continue auomating my app
To see what elements your screen has at a certain moment, put
in your script. It will show all elements with their accessibility properties (name and value) in your app's current state.
If your buttons has not names, you have to set accessibility properties in your XCode project for these buttons, see there.