How can I find a textfiled by name in automation testing? I am able to get the element by index which is not helpfull. In my nib the accessibility label of the button is set to "btn", but when executing that line of code it throws an exception because it can t find the button. Any suggestions?
var target = UIATarget.localTarget();
var mainWindow = target.frontMostApp().mainWindow();
// This does not work
mainWindow.buttons()["btn"].tap();
// This works
mainWindow.buttons()[0].tap();