XPath is not the best selector then which one should be used?

It is always suggested & good to use id, name, className & other selectors in place of XPath but Do we get to know just by...