How to find click a element that don't have a text or any specific description

I can’t able to click this menu button in this app. please help me to find the element id and make it clickable.

I tried with following methods,

Absolute Xpath:-


Relative Xpath:-




How to cam eto know the particular class name for the particalur element(Menu).

Please help me :smile:

you have missed (//) in your relative Xpath and android.widget.ImageView is class Attribute Value but you are not suppose to use as a tag name…
Relative Xpath:-
should be driver.findElement(By.xpath("//tagName[@clickable=‘true’]")).click();


Vijay Bhaskar.

  1. If you have className as android.widget.ImageView only for that particular element…you can directly use it by By.className(“android.widget.ImageView”);
  2. If you have multiple classNames… you can return them into a List, and then click based on index
    List buttons = driver.findElements(By.className(“android.widget.ImageView”));
    buttons.get(0).click(); or buttons.get(1).click();
  3. Please don’t go for Absolute Xpath, because it is lengthy and takes more time…go for Relative and let me write xpath based on your image…

Hope this helps you.

Vijay Bhaskar.

Thank you @bhaskar now I clearly understood that how to take element for such case.

1 Like

That is the menu button, so short cut would be to use adb keycodes which are built into appium. In Ruby, I’d write it this way

appium_driver.driver.press_keycode 82
1 Like

Hi Bhaskar,
I am trying to create xpath based on class name and index or content-desc but its not working for me:

I have tried
obj_android.findElementByXPath("//[@class=‘android.widget.Button’] and [@index=0]");
obj_android.findElementByXPath("//*[@class=‘android.widget.Button’] [@content-desc=’.’]");

Can you please help in this


Could you post “Button” properties or share the screenshot when control is on Button.?


If your element doesn’t have any particularly unique attributes consider the following:

  • Ask the developer to provide some. That’s really the most ideal solution and brings a variety of benefits to users and automation.
  • Explore Xpath Axes, this allows you to craft an xpath to a clearly identifiable element that has some known organizational relationship to your target element. For example, if there’s always a Searchbar element right after the Menu element in the DOM, you can use the Searchbar element’s xpath, and call the previous-sibling (or whatever the appropriate axes is) to find the menu reliably. Read more here:

This may be simple-minded answer, but given the icon, isn’t that the menu button? Can you just send press_keycode :menu?

I recommend you use findElementsById as it’s more reliable and less complex than xpath

From there, you can use the index, or you can match by text

I have two Buttons which have same index number ,class and package rest of the information is not given ,I am inspecting one of the element called search but everytime it is clicking the Kontakt buttomn , Please suggest me how to overcome this problem .


Please see attached screenshot .

Hey did you find the solution for this? If yes can you please share?

How about using index property ?