DEV Community

Discussion on: An end to the abuse of Accessibility IDs

Collapse
 
hdesaidave profile image
hdesai-dave • Edited

Hi i am able to find element with xpath but not id for an element where i added testID using webdriverio.

selector = $(//*[@resource-id="bank"]); works

selector = $(id:bank); doesn't work

The way you suggested in post

selector = $(id=bank) also doesn't work.

Collapse
 
nextlevelbeard profile image
Ricardo Barbosa

It seems it's a problem with Appium, it modifies your selector and adds the package name automatically on Android. In short, finding the element fails because you didn't specify the package name in the testID of your app. I've updated the article with some more info and a technical solution, hope it helps!

Collapse
 
hdesaidave profile image
hdesai-dave

Thanks man this worked but wondering why would react native not implement this in the framework themselves?