Site icon TestingDocs.com

Absolute and Relative XPath Expressions

Overview

In this tutorial, we will learn about Absolute and Relative XPath Expressions, which are the mechanisms for identifying an element in the document. XPath is a query language used to identify elements in documents. Types of XPath expressions are:

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

Exit mobile version