I had this problem too, and I find it typing a line too quickly.
It seems that the key names change depending on the state of the shift.If button. The shift is on, then the key is called "N", if the shift is not on, then it is "n". You will notice how the line is typed that the toggle button is pressed before entering an uppercase letter. Your test tries to press the "N" key before pressing the "Shift" button. This does not affect the first letter of your sentence, because the keyboard has a shift for the first letter.
This also affects the entry of a lowercase character after the uppercase character: the lowercase character can be printed while the shift button is in the process of being pressed.
I use a workaround to enter each letter of a string using separate typeString () methods.
for (i = 0; i < title.length; i++) { var strChar = title.charAt(i); target.frontMostApp().keyboard().typeString(strChar); }
The disadvantage of this is that it takes a lot longer to enter the full line.
You can also see the following link, which offers a similar solution, but uses the app.keyboard () method. keys (). tap () for each character of the string instead of the typeString () method. http://jojitsoriano.wordpress.com/2011/06/27/ios-ui-automation-typing-a-string-in-a-uiatextfield/
source share