Reputation: 313
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
Upvotes: 0
Views: 266
Reputation: 313
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")
Upvotes: 0
Reputation: 2803
Try using query("android.support.v7.widget.ActionMenuView")
and see how many elements you get, then identify the one you need, maybe by 'id'
or 'content-description'
which should be unique.
You could try using the uiautomator
from your Android SDK. It's a very helpful tool to identify elements and see the hierarchy.
Usually located in your sdk folder under \tools\bin
. You will see something like this:
Now you could go through the children of that ListView in order to access what is needed, something like this (used above image as example):
query("android.widget.ListView android.widget.LinearLayout id:'title'")
Let me know if it worked, there might be other ways.
Upvotes: 1