Search code examples
androidautomated-testsandroid-testingcalabashcalabash-android

How to touch the overflow button in calabash-android?


I'm trying to touch on the overflow button in my app using calabash-android testing. after so much of research i found a method to touch the overflow button.

tap_when_element_exists("android.support.v7.widget.ActionMenuView")

this worked for me when there was only one overflow button in screen and no other buttons. But for a screen like the picture below, which has overflow button and other buttons above method is not working. I tried with index also,

tap_when_element_exists("android.support.v7.widget.ActionMenuView index:0"),
tap_when_element_exists("android.support.v7.widget.ActionMenuView index:1")

, etc but still not solved.

Then i used this method-

select_options_menu_item("* id:'action_change_notification'")

but when i used this method, the overflow button is invoked but cannot touch the items in it

enter image description here


Solution

  • i found a better solution. and it works perfectly.

    This could give you the overflow menu button in the screen.

    query("android.support.v7.widget.ActionMenuPresenter$OverflowMenuButton")
    
    tap_when_element_exists("android.support.v7.widget.ActionMenuPresenter$OverflowMenuButton")