xpath axis positioning of selenium (appium the same applies)

1. XPATH axis positioning scenarios

xpath axis positioning, the respective application scenario when an element property, and combinations thereof are insufficient positioning, it can be positioned by various elements may be positioned in the parent node or its sibling like.

Usage 2. XPATH axis positioning description

What 2.1 XPATH axis?

The following screenshot is a reference to the rookie tutorial (link: https://www.runoob.com/xpath/xpath-axes.html )

Common axis computation Name:

ancestor: ancestor node, including the parent node

parent: parent

preceding: all current node before the element node label (HTML page order)

preceding-sibling: all siblings before the current element node label (sibling)

following: All current node (HTML page order) after the element node label

following-sibling: all currently siblings (same level) after the element node label

2.2 Syntax

 Axis name :: node name

Illustrate how to position:

 

As shown above, according to the element 1 to position the elements 2, the positioning shaft is used here, first find the parent of the element 1 - sibling nodes - the child node, thereby to find the element 2

 

 

Guess you like

Origin www.cnblogs.com/htx18/p/11851647.html