I just want to test my iOS interface using UI Automation, but I got stuck when it came to entering text into UITextFields. The documentation says that the "setValue (...)" method should do the trick, but that is not the case.
I always get this error:
Script threw an uncaught JavaScript error: Unexpected error in -[UIATextField_0x9952690 setValue:], /SourceCache/UIAutomation_Sim/UIAutomation-271/Framework/UIAElement.m line 1142, kAXErrorSuccess on line 15 of login.js, #0 setValue()
The code is as follows:
var textfields = UIATarget.localTarget().frontMostApp().mainWindow().textFields(); username = textfields["username"]; username.setValue("test");
The username field is not null or undefined.
My second solution was a JS project: https://github.com/alexvollmer/tuneup_js#readme It has a "typeString" method for text fields, but it is a bit buggy and does not work when a number and capital letters are entered.
I work with iOS6.1, Tools Version 4.6 (46000), Xcode Version 4.6 (4H127).
Any help is appreciated!
source share