It depends. Xpath should only be used in where name or id are dynamic(changes randomly). Downside of xpath is that it uses more cpu cycle. Are developing any bot?
XPath can use ID and other selectors too. This decision is case-by-case basis and depends on the site and how it changes. Sometimes websites generate new IDs on every load but sometimes not and so ID can be brilliantly easy since it's unique.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.