Calling typeString fails with the following error:
Error: (2012-10-09 15:14:20 +0000) - VerboseError: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().keyboard().buttons()["shift"]
Below is the section of my UIAElement tree dump related to the keyboard. As you can see, the "shift" key is present. I don't know what you can do to fix this.
UIAWindow "(null)" {{256, 0}, {768, 1024}}
elements: {
UIAImage "kb-drop-shadow-top.png" {{0, 416}, {1, 16}}
UIAImage "kb-drop-shadow-top.png" {{0, 416}, {1, 16}}
UIAImage "kb-drop-shadow-bottom.png" {{0, 416}, {1, 17}}
UIAImage "kb-drop-shadow-bottom.png" {{0, 416}, {1, 17}}
UIAImage "kb-drop-shadow-center.png" {{0, 416}, {28, 245}}
UIAImage "kb-drop-shadow-center.png" {{0, 416}, {28, 245}}
UIAKeyboard "(null)" {{0, 416}, {1024, 352}}
elements: {
UIAKey "q" {{0, 425}, {93, 79}}
UIAKey "w" {{93, 425}, {93, 79}}
UIAKey "e" {{186, 425}, {93, 79}}
UIAKey "r" {{279, 425}, {93, 79}}
UIAKey "t" {{372, 425}, {93, 79}}
UIAKey "y" {{465, 425}, {93, 79}}
UIAKey "u" {{558, 425}, {93, 79}}
UIAKey "i" {{651, 425}, {93, 79}}
UIAKey "o" {{744, 425}, {93, 79}}
UIAKey "p" {{837, 425}, {93, 79}}
UIAKey "Delete" {{930, 425}, {94, 79}}
UIAKey "a" {{38, 511}, {92, 79}}
UIAKey "s" {{130, 511}, {92, 79}}
UIAKey "d" {{222, 511}, {92, 79}}
UIAKey "f" {{314, 511}, {92, 79}}
UIAKey "g" {{406, 511}, {92, 79}}
UIAKey "h" {{498, 511}, {92, 79}}
UIAKey "j" {{590, 511}, {92, 79}}
UIAKey "k" {{682, 511}, {92, 79}}
UIAKey "l" {{774, 511}, {92, 79}}
UIAButton "Return" {{866, 511}, {158, 79}}
UIAKey "shift" {{0, 597}, {91, 79}}
UIAKey "z" {{91, 597}, {91, 79}}
UIAKey "x" {{182, 597}, {90, 79}}
UIAKey "c" {{272, 597}, {91, 79}}
UIAKey "v" {{363, 597}, {90, 79}}
UIAKey "b" {{453, 597}, {91, 79}}
UIAKey "n" {{544, 597}, {90, 79}}
UIAKey "m" {{634, 597}, {91, 79}}
UIAKey "," {{725, 597}, {90, 79}}
UIAKey "." {{815, 597}, {90, 79}}
UIAKey "shift" {{905, 597}, {119, 79}}
UIAKey "more, numbers" {{0, 683}, {273, 79}}
UIAButton "Next keyboard" {{136, 683}, {137, 79}}
UIAKey "dictation" {{181, 683}, {91, 79}}
UIAKey "space" {{272, 683}, {543, 79}}
UIAKey "more, numbers" {{815, 683}, {118, 79}}
UIAButton "Hide keyboard" {{933, 683}, {91, 79}}
}
UIAImage "kb-drop-shadow-bottom.png" {{0, 766}, {1024, 17}}
}