XPath Axes
Common Locator Strategies
id
name
class name
link text
css selector
xpath expression
👉 XPath expression is powerful
Key Concept
Sometimes we are not able to write a proper XPath expression directly.
In such cases, we can use XPath Axes.
What are XPath Axes?
XPath Axes help us indirectly locate required UI elements on a web page.
They allow navigation through the DOM (Document Object Model) relative to other elements.
Why Use XPath Axes?
When elements don’t have unique attributes
When direct XPath is difficult or unstable
To locate elements based on relationships (parent, child, sibling, etc.)
Next Session:
Different Types of XPath Axes