Selenium Locators – XPath AXES

Selenium Locators – XPath AXES

<<Previous Post                            << Complete Tutorial>>                              Next Post>

XPath Axes is a concept that makes the XPath Expressions powerful and unbeatable in locating the UI elements out of all the locator types.

We generally go with the XPath Axes in the XPath Expressions when we want to locate the required UI elements with the help of id/name/class name attribute values of the other UI elements. Here the other UI elements may be grandparent/parent/sibling/child/grandchild of the required UI elements to be located.

Before I practically demonstrate using different XPath Axes for locating the UI elements, I will first list down the XPath Axes available as part of this article.

The following are the different XPath Axes available:

  1. ancestor
  2. ancestor-or-self
  3. attribute
  4. child
  5. descendant
  6. descendant-or-self
  7. following
  8. following-sibling
  9. preceding-sibling
  10. namespace
  11. parent
  12. preceding
  13. self

Out of all the above available XPath Axes, the below will be enough for our learning in Selenium:

  1. following
  2. preceding
  3. following-sibling
  4. preceding-sibling
  5. parent
  6. child
  7. ancestor
  8. descendant

Here concludes this article.

In the next article, I will start explaining the first XPath AXES – following

Next Steps:

  • > To learn more about Selenium, continue to the next post (Click on Next Post link below)
  • > Check complete Selenium Tutorial Contents here (Click here)

Please leave your questions/comments/feedback below.

Happy Learning ?

About Me > Arun Motoori

On a mission to contribute to the Software Testing Community in all possible ways.

<<Previous Post                            << Complete Tutorial>>                              Next Post>

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

For FREE Testing Tutorials & Videos

Open chat
Contact Us on Whatsapp