power_settings_new

Is there any disadvantage of xpath.?

by
asked
+1 vote
616 views
Now I learnt how to locate elements with xpath .I am just right clicking
and copying the XPATH.
Now life seems to be lot easier than trying to find with others like cssselector, etc.
Is there any disadvantage of xpath.
 

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by (171 points)
selected by
0 votes
 
Best answer

there is not disadvantage of xpath. If you use relative xpath it will be helpful.

xpaths are not mostly supposed on earlier version of browsers, spetially Internet Explorer. IE doesn't support nth-child. Also many of mobile browsers spetially iphone safari will not support xpath. So if you are developing script for more  number of browsers, I would suggest avoiding xpath.

commented by
Thanks Mayur for the answer.I will take care while coding for Mobile browsers and IE.          In these cases we have to use other selectors like ID,name,className etc Isnt it.

Regards
Uday
commented by (171 points)
Yes. Try using CSS selector as well instead.
add
...