XPath Selector Testing with queryXPathAll

Selecting any tag: //*

Selecting any tagname: //li

Selecting attribute presence: //*[@class]

Selecting attribute exact value: //*[@class='target']

Selecting attribute value contains: //*[contains(@class, 'target')]

Selecting when text content contains: //*[contains(text(),'item')]

Selecting by partial tagname: //*[starts-with(name(), 'custom-')]

Selecting by partial attribute name: //*[@*[starts-with(name(), 'data-custom-')]]

Selecting parent element: //parent::*

Selecting preceding siblings: //preceding-sibling::*

Selecting individual preceding siblings: //preceding-sibling::*[1]

Selecting following siblings: //following-sibling::*

Selecting individual following siblings: //following-sibling::*[1]

Selecting by number of children: //*[*[3]]

Selecting comparing attribute value as number: //*[@data-price >= 5]

Selecting heading 1-6 tags: //*[substring-after(name(), "h") > 0]

Selecting by an element it contains (like :has()): //li[strong]

Selecting the last child: //*[not(following-sibling::*[1])]

We should see ONLY the following elements selected:

div

p span