Can anyone please help with the difference between the below XPaths and help me understand which of these to use when. I have found all three of them to work but not sure when to use them.
Get Element Text ${output} //priority
Get Element Text ${output} .//vrrp-group/name
Get Element Text ${output} ..//track/priority-hold-time
//
selects among descendant or self nodes (along the descendant-or-self
axis). It is short for /descendant-or-self::node()/
.
//
starts from the root node, thus covering the entire document..//
starts from the context node...//
starts from the parent of the context node.//priority
selects all priority
elements in the document..//vrrp-group/name
selects, beneath the context node, all name
elements with a vrrp-group
parent...//track/priority-hold-time
selects, beneath the parent of the context node, all priority-hold-time
elements with a track
parent.Robotframework note:
In the context of the Get Element Text
Robotframework XML library command, the XPath must be relative to the source node (${output}
in your case). Absolute XPaths such as //priority
are not allowed there.