Xpath Locators Flashcards
Xpath uses path expressions to…
identify and navigate nodes in an XML document.
xpath expressions are related to…
path expressions in traditional computer file system.
Xpath predicates
Are used to find a specific element or an element that contains a specific value.
Xpath wildcards
Can be used to select XML nodes based on a specified criteria.
Path Expression: TheNode
Selects all elements with name “TheNode”
Path Expression: /
Selects the root element.
Path Expression: //
Returns descendants of the current element.
Path Expression: .
Returns the current element.
Path Expression: ..
Selects the parent of the current element.
Path Expression: @
Selects an attribute of the current element.
Xpath wildcard: *
Matches any element node.
Xpath wildcard: @*
Matches any attribute node.
Xpath wildcard: Node()
Matches any node of any kind.
XPATH EXPRESSION: Magazines
Selects all nodes with the name “Magazines”
XPATH EXPRESSION: /Magazines
Selects the root element “Magazines”
XPATH EXPRESSION:Magazines/Magazine
Selects all Magazine elements of Magazines