Element with id can't be located with @AndroidFindBy(accessibility = "loginEmailText")

I’m automating react native app, and we start to use accessibilityLabel, so the “accessibilityLabel” can’t be used in all elements for automation as I need. so I’m trying now to use testID also for android, in the app, so inspector identify this id but appium can’t locate this element by id.
What can I do ? how appium can locate the element with @AndroidFindBy(accessibility = “loginEmailText”). see image . Thanks !

I am testing an android app written in Jetpack Compose. I also found that sometimes it fails to get by Id. In those cases I use Xpath using the following locator:

//*[@resource-id='loginEmailText']

This will find any element in the xml tree that has ‘loginEmailText’ as a value in the ‘resource-id’ attribute

You can change ‘resource-id’ to any other attribute in the XML too.

Thanks a lot it’a worked

1 Like

Thanks a lot it’s worked