Using XPath Axis to find elements - Selenium

As we have seen, XPath is normally only used if the element we need to interact with is not accessible by normal means. In this section of the chapter, we are going to have a look at leveraging XPath Axis in our queries to find the element that we wish to interact with.

An example that I have used in the real world was to find a table cell that had specific text, then traverse the tree backwards to find the edit button so that I could click on it. This may seem like an extreme example just to click on an edit button but is extremely common according to the Selenium Users forum on Google Groups.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Selenium Topics