Recuorce ID is missing on most of the native apps uiautomatorveiwer

Hi

I am new to Appium and automated testing. I am trying to find elements using uiautomatorveiwer on S5 android version 4.4.2.

The issue that I have is that I am able to see the resource ids for some of the native apps however the resource ids are missing for most of the native apps.

Please advise if there is any workaround for this. I have seen someone mentioning to use xpath, if xpath is a workaround, can you please provide a concrete example how it can be used.

Thanks in advance.

T.K

Are you certain you’ve drilled down far enough in the tree? What I’ve found is many of the elements don’t have a resource-id until you’ve drilled down to the elements containing actual data.

Thanks for the reply, I have but I am still unable to see the resource-ids.

You can use other locator strategies -

findElementByClassName
findElementByAccessibilityID
findElementByText
findElementByXpath

@Teddy_k,

I’ve noticed the same thing with Android native apps. Many of these were developer before the resource_id was exposed, so I’m charitably guessing that is why it’s not present. We’ve made saome attempts to work around this problem, including

A) Search by text content
B) Search by class name if relatively unique enough for your purposes
C) xpath in combination with the two above

In case you are as unfamiliar with xpath as I was, you can search relative to an object you’ve found, so if you want to check the checkbox associated with the TextField with certain text, you can use xpath to identify the the text file, then append ‘…/android.widget.CheckBox’ if the checkbox has the same parent

Thanks guys for your inputs! I was able to use search by test/content-desc and that worked fine.
However I still see some limitations. I was planning to go to Camera and take a picture, I went all the way to camera but once I am there, it seems all buttons have exactly the same details, There is no detail unique enough to identify each and every button/clicks. Everything is uniform. I did not dig much into xpath as you suggested, but I will and see it helps to solve some the problems I face.
Thanks for the collaboration and your time!

T.K