Selenium WebDriver Tutorial #13 – What is Relative Locator in Selenium

In this Selenium Webdriver Tutorial, we will learn about the Relative locator in Selenium Webdriver.

Selenium 4 introduced Relative Locators which were previously called Friendly Locators. Relative locators help to locate elements that are nearby to other elements.

The Available Relative Locators are as follows:

✅ above

✅ below

✅ toLeftOf

✅ toRightOf

✅ near

In Selenium 4, find the Element method accepts a new method with TagName() which returns a Relative Locator.