Locating Strategies- (By XPath- Using Single Slash)

In this section, you will learn how to locate a particular web element by XPath- Using Single Slash.

Single Slash mechanism is also known as finding elements using Absolute XPath. Single Slash is used to create XPath with absolute XPath i.e. the XPath would be created to start selection from the document node/ Start node/ Parent node.

Note: XPath Absolute is not recommended because it takes the complete XPath location and if the location of the web element is changed or it belongs to some other parent then XPath will be unable to locate the desired element.

The syntax for locating elements through XPath Absolute is written as:

Using Single Slash/Absolute XPath, we can write the Java code along with the dynamic XPath location as:






Latest Courses