Find elements only by Xpath

Good evening,

I’m trying to test some android app, but I can only find elements by xpath, I wanted to find them by ID but i’m not being able to do it.
I already tried the resource-id and id which are the same.
I tried the methods findElementById and ByClassName and AccessibilityId. None worked, only appiumDriver.findElementByXPath(“some path”);

Thanks in advance.

You will only find the element by ID if there is an ID on the element.

I can find using this:
driver.findElementByXPath("//android.view.View[contains(@resource-id,‘burgerMenuIcon’)]").click();|
But not this:
driver.findElementById(“burgerMenuIcon”).click();|

And you are sure that the element has “burgerMenuIcon” set as id?
id and resource-id is not the same thing.


By the way what’s the difference?