Search code examples
androidcalabash

Sending tab key event?


Is it possible to send a tab key press with calabash? I'm having difficulty selecting elements in a browser view on Android.

I've tried the following things:

enter_text("WebView css:'#Email'", "[email protected]")
enter_text("android.widget.EditText id:'#Email'", "[email protected]")

But they don't seem to be seen by calabash to select. I'm now wondering if I send certain number of tab presses, I should also end up in the field that I want. How do I send a tab key press though?

Additionally, is it possible to send text to an element that has the active focus, without specifying an id of the element?

Thanks in advance


Solution

  • "Is it possible to send a tab key press with calabash?"

    Yes, it is.

    press_user_action_button('next')

    If you are using Cordova, you should change the Webview to cordovaWebView or SystemWebView.

    enter_text("SystemWebView css:'#Email'", "[email protected]")

    "Additionally, is it possible to send text to an element that has the active focus, without specifying an id of the element?"

    Yes, it is.

    keyboard_enter_text("text")