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