UIAKeyboard.typeString() cannot set value on invalid element: UIATextField

Originator:joshuajmoody
Number:rdar://17869497 Date Originated:31-Jul-2014 02:17 PM
Status:Open Resolved:
Product:Developer Tools Product Version:5.1.1
Classification:Serious Bug Reproducible:Sometimes
 
Summary:
I have been plagued by this problem for over a year.

Steps to Reproduce:
### To reproduce:

1. clone this repository:  https://github.com/jmoody/animated-happiness
2. build and run the 'chou' target with Xcode 5.1.1 with base SDK 7* simulator or physical device
3. launch Instruments 5.1.1, target the chou app on the target from 2.
4. execute the follow script in a UIAutomation template

```
var target = UIATarget.localTarget();

for (i = 0; i < 1000; i++) { 
	UIALogger.logDebug("starting iteration: " + i)
	target.frontMostApp().mainWindow().elements()["first page"].textFields()["text"].setValue("");
	target.frontMostApp().mainWindow().elements()["first page"].textFields()["text"].tap();
	target.frontMostApp().keyboard().typeString("Hello");
	target.frontMostApp().keyboard().typeString("\n");
	target.delay(1);
}
```

Increase the number iterations until you get a failure.

For fun, try a more complicated string like: "}=k,Gk-f\"&7{2&ZRq$2zyzsq#y.R,?<R)T;w,xQYm€*3!,Nu?PY"

Expected Results:
### Expected

UIAKeyboard.typeString() to work without error.

Actual Results:
### Actual

VerboseError: Cannot set value on invalid element: UIATextField from UIATextField

Version:
* OS X 10.9.4 (13E28)
* Xcode 5.1.1
* Instruments 5.1.1
* iOS 7


Notes:
* https://github.com/calabash/calabash-ios/issues/269
* https://github.com/calabash/calabash-ios/issues/259
* http://stackoverflow.com/questions/10549046/target-frontmostapp-keyboard-failed-to-locate-key-n

Related iOS 8b4

https://devforums.apple.com/message/1013742#1013742

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!