Search code examples
androidandroid-actionbarmonkeytalk

MonkeyTalk Click on ActionBar home button


Is there a way how to click on action bar Home button (http://developer.android.com/guide/topics/ui/actionbar.html)?

I tried

Label ${myHomeId} Tap

I just receive

Completed Script Playback - OK

but nothing happens... the activity is supposed to get back to the home screen.

The same for clicking on Menu Settings is working:

Label menu_settings tap

Is it a bug?


Solution

  • It can be clicked using the ADB command:

    adb shell input tap 100 100
    

    MonkeyTalk script looks like this:

    #tap_actionbar_home.mt
    Vars * Define x y
    System * Exec adb shell input tap ${x} ${y}
    

    The it is call from another script using:

    Script tap_actionbar_home.mt Run 100 100
    

    The values 100 and 100 may differ of course.