In this post we will discuss understanding and working with Xpath and how to use the same in selenium.
What is Xpath
- Xpath is a syntax for defining parts of an XML documents
- Xpath is major element in XSLT
We are not going to deal with the theory of Xpath, which you can always get from lot of website and the best of them all is w3school
Working on xpath
Locating element with xpath
can be formed either by hand coding
, if you have good knowledge on the structure of the page or by using tools like Firepath
Some common Xpath tidbits
||Selects from the root node
||Selects nodes in the document from the current node that match the selection no matter where they are
||Selecting with the attribute
||Selecting all descendant divs from current node
||Selecting the last div from the current node which is descendant (Used Predicate as well !!!)
||Selecting next sibling from current node
Here is the complete video of the above discussion
Thanks for watching the video !!!
Please let me know if you have any questions from the above video.