Where is XPath used in Selenium?

Where is XPath used in Selenium?

XPath is used to locate any element on a webpage using the HTML DOM structure. If the elements are not found by the general locators such as ID, class, name, etc., then XPath is used to find an element on the web page in Selenium automation.