I have a search field in my application and I set the return key type for this field to UIReturnKeyNext . I am trying to write a UIAutomation test that clicks the Next button on the keyboard using the following line:
UIATarget.localTarget().frontMostApp().mainWindow().keyboard().keys().firstWithName("next");
This call fails because a key with the name "next" was not found. I did a reset of all the elements in my application using:
UIATarget.localTarget().frontMostApp().logElementTree();
This shows that there is a key on the keyboard named "next", but somehow my attempt to get it, as shown above, still fails. However, I can get other keys (for example, the key for the letter "u") using this method. Is there a known issue here, or am I doing something wrong?
I tried other options with no luck:
UIATarget.localTarget().frontMostApp().mainWindow().keyboard().elements()["next"];
Here is the screen capture of elements in my UIAKeyboard:

kodie source share