xpath, css select the positioning elements

xpath positioned elements

// * : find all the elements within the page
 // div: only to find the page div
 / : next level 
# single attribute positioning   
// div [@ classname = ' daliuliu ' ] # positioning of page classname is daliuliu div

# multi-attribute positioning   // div [@ classname = ' daliuliu ' and @ name = ' name ' ] # positioning page classname is daliuliu, name = name of div

#-level positioning   // div [@ classname = ' daliuliu ' ] / the INPUT [@ type = ' text ' ] # positioning for the next page classname daliuliu the div, type = text input element

# Location subscript   div // [@ classname = ' daliuliu ' ] / input [@ type = ' text ' ] [. 1] # positioning for the next page classname daliuliu the div, the first input element type = text

css_select positioned elements

# Css_select positioning element 
# this way no subscript xpath like that kind of value, when a plurality of positioning elements need to be located by a hierarchical manner to the element you want 

# positioning element id     #daliuliu # id is the positioning of daliuliu element 

# positioning element class 
    .daliuliu   # positioning element class is daliuliu 

# with custom attributes targeting element 
    div [name = ' name ' ] # Location name = name of div 

# multiple attribute originally positioned 
    div [name = ' name ' ] [className = ' daliuliu ' ] # Location name = name, classname = daliuliu this div 
# level location 
    div [name = ' name ']> INPUT# Positioning div name = input elements under the name

 

Guess you like

Origin www.cnblogs.com/liushuxian/p/11390380.html