Overview
In this tutorial, we will learn about Absolute and Relative XPath Expressions. These are the mechanisms to identify the element in the document.
XPath is a query language to identify elements in the documents. Types of XPath expressions are:
- Absolute XPath Expression
- Relative XPath Expression
Absolute XPath
An absolute XPath is the complete path from the root node of the document. The absolute path starts with ‘/’
For Example:
/html/body/div/input
Relative XPath
The relative XPath starts with the ‘//’ and search for the element relative from the current node.
For Example:
//input