Accessibility id vs id

In some places we can locate element by accessibility id or by id.

Is one be prefered over the other one while both locators are available?

1 Like

Accessibility Id is a better approach. The main advantage is that it can be set by the developers. So you get it in the way you want. Also, if you want to run scripts cross platform (ie both Android and iOS), then Accessibility Id would be of great help as you can use same ids for both android and ios

Thanks!

SO I want to use accessibility id in my fluentwait however it is missing from the By class.

Any idea how to handle it?

1 Like

Hi @menypeled

What’s you java client’s version?

BR

Try this
driver.findElementByAccessibilityId("RootTopLeftMenuButton");

This should work

Thanks

1 Like

If you want to keep the ‘By’ around:

MobileBy.AccessibilityId(useKey);

3 Likes