What are the best way lo locate elements using xpaths?

Hello Guys ,

What are the best way lo locate elements using xpaths? which atributes do you choose ?

I use appium inspector it provides xpaths. Of course better option is using ids (accessibility id in iOS).

1 Like

for xpath you can use all types of attributes like ID’s ,classes and texts , it is also important to mention contains -when you are dealing with partially changing texts - it is easy when you could identify the element.
XPath provided by inspectors always are long and not readable and sometimes it doesn’t work.so if you are working with hybrid apps you can check the correctness of your xpath by clicking ctrl + F and it will show you all the located elements related to the given path.

1 Like