Question: why xpath is not recommended?
Answer: The reason is that the infrastructure used to generate the XPath, doesn't guarantee that the XPath will remain the same between two different executions. ... The recommended way would be to use id or any other stable element identifier, or to search for a parent element and then use the relative XPath from that element.