2011-05-23

UIAKeyboard keys and buttons

I've just discovered that the UI Automation keyboard doesn't only consist of keys, but also of buttons: All elements with light gray background are keys and all those with dark gray background are buttons.

I could write for example:

app.keyboard().keys()["e"].tap();
app.keyboard().buttons()["return"].tap();















But the distinction is only an option, because the elements are also accessible via the elements() method:

app.keyboard().elements()["e"].tap();
app.keyboard().elements()["return"].tap();

7 comments:

  1. Any idea how to tap the "hide keyboard" button?

    ReplyDelete
  2. Found it:
    …keyboard().buttons()["Hide keyboard"].tap();

    To find the name i used:
    for(i = 0; i < 100; i++){
    app.keyboard().buttons()[i].logElement();
    }

    ReplyDelete
  3. Do you know how to access a PopOver when scripting an iPad app?

    ReplyDelete
  4. You could have said:
    app.keyboard().logElementTree();

    There is an own UIAPopover class to handle popovers ;)

    ReplyDelete
  5. Yea the elementTree is way smarter. Silly me forgot about it :-)

    I know the UIAPopover class, my problem was to access the UIAPopover object. Finally i found it is a child of the mainWindow and not of the the scrollView.

    ReplyDelete
  6. Do you have another hint?

    After using the popover (selecting something and dismissing it thereby) i cannot tap() on any buttons anymore. Tap() on buttons has then no effect anymore. Before it did. Typing in textfields still works.

    ReplyDelete
  7. Try it with Xcode 4.2 Developer Preview. If it still doesn't work, then file a bug in the Bugreporter.

    ReplyDelete