The major XPath axes follow family tree terminology:
self::
is you.
Downward:
child::
are your immediate children.descendant::
are your children, and their children, recursively.descendant-or-self::
(aka//
): are you and your descendants.
Upward:
parent::
is your mother or father.ancestor::
are your parent, and your parent's parent, recursively.ancestor-or-self::
are you and your ancestors.
Sideways (consider elements earlier in the document to be younger):
previous-sibling::
are your younger siblings, in age order.following-sibling::
are your older siblings, in age order.previous::
are your younger siblings and their descendants, in age order.following::
are your older siblings and their descendants, in age order.
---------------------------------------------------------------------------------------------------------------------
child::
will select the immediate descendants of the context node, but does not go any deeper, likedescendant::
does.following::
will select all of the nodes that come after the context node and their descendant's, but that does not include the context node's descendants.descendant::
will select all of the nodes along thechild::
axis, as well as their children, and their children's children, etc..
Sometimes, a picture is worth a thousand words:
1 comment:
Such a nice blog with the reference links. Thanks for sharing with others.
Testing With Selenium
Career in Selenium
Post a Comment