1. Two concepts :
(1)xml: Extensible markup language , Yes HTML Extension of , Grammar and HTML be similar , However, its tags and attributes can be defined according to business needs , and HTML The tags and attributes in are fixed .
(2)xpath:xml
path, namely xml Path language , Yes xml A technique for finding elements or attributes in , Find information by describing the path of the element in the whole file .( Simply put, it is the path of the element )
explain :html It can be regarded as a kind of fixed mark xml, therefore xpath Can also be applied to html Find elements in , and selenium
WebDriver Inside xpath Positioning is using xpath Expression to describe the path of the element , So as to locate the element .
2.xpath Expression classification :
(1) Absolute path : Start at root ,root.
for example :
Absolute path :/html/body/( Single slash start )
(2) Relative path : Under one path , Other paths refer to this path .
for example :
Relative path //( Start with double slash )
So both relative path and absolute path can find the file or file you want html element .
however , It is generally not recommended to use absolute paths , To find elements with relative paths .
as a result of :
- Front end Engineer : Change page effect , Add a special effect . Add a few div
- Absolute path
Technology