So in my nib file i enabled accessibility and set the accessibility label of a textfield to "txt" I am trying to find this textfiled based on accessibility name and change its text.
var target = UIATarget.localTarget();
var application = target.frontMostApp();
var mainWindow = application.mainWindow();
mainWindow.logElementTree();
// This works
var textField = mainWindow.textFields()[0];
//this doesn't work
var textField = mainWindow.textFields()["txt"];
textField.setValue("Hello");
Am I doing anything wrong? How can I find a label based on accessibility label?
EDIT:
I am open to other solutions as well, I am trying to avoid getting the textfield based on the index