I'm currently working on an automation script (JavaScript) for an iOS app. I'm not a programmer, just a tester who wants to seek bugs.
Software concerned: Xcode, Instruments.
Here is the problem: there are buttons in my application that had no name, which is important for automated tests, so I gave them a Label in the Accessibility field of Xcode. But Instruments still doesn't recognize the name of the buttons.
e.g.: What I want, but doesn't work:
target.frontMostApp().mainWindow().scrollViews()[2].buttons()["Settings"].tap();
What I don't want, but works:
target.frontMostApp().mainWindow().scrollViews()[2].buttons()[1].tap();
This is just one of many situations I've encountered. I chose a simple one and it could seem trivial, but some others are really problematic.
Any idea how to fix this?
Do you create the code by typing it, or do you capture it?
If you havn't captured it: you can do that by using that small record button in the JavaScript editor. After capturing, Instruments shows you the code, that would automate the actions you did "by hand". Then you can find out, if there is a different way to adress the button. This way you can find out how to trigger your button I havn't set up my GUI elements with the acessibility properties, because this way I can find out how to trigger the elements.
It sometimes takes a few tries to get things running.
Also, if an animation is applied when the screen is changing, a delay is needed before you can trigger the next GUI event:
target.delay(1);
This creates a delay of 1 second until the next event is fired.
Hope this helps