In this Selenium XPath tutorial, we will learn about the XPath axes method ancestor and ancestor-or-self with examples.
XPath axes’ ancestor method helps in selecting all the ancestor nodes of the current node.
XPath axes’ ancestor-or-self method helps in selecting the current node as well as all the ancestor nodes of the current node. Watch the full tutorial to understand XPath axes’ ancestor methods with examples.