1. Positioning by the text content of the element
1.1. Function text(): the text content of the element, the full text content matches
//*[@id="xxx"]//p[text()="xxxx"] The element text under the p tag is xxxx
1.2 Function contains (@attribute/text(), value): element attribute, text contains a certain value
contains(@class,‘XXXX’)、
contains(text(),'XXX')
2. Logic operations
and means condition and
or means condition or
//div[@class="one" and contains(@style,"two")] #div tag under the class attribute is one and contains elements whose style value is two
3. Axis calculation
ancestor: ancestor node, including parent
parent: parent node
preceding: all nodes before the current element node label
preceding-sibling: all sibling nodes before the current element node label
following: all nodes after the current element node label
following-sibling: all sibling nodes after the current element node label
Usage syntax:
Axis name:: node name
//div//table//td//preceding::td