Selenium personal note Shu positioning

Eight elements object localization method

  1. xpath positioning (common)

    ( 'Absolute / relative address elements') find_element_xpath

    ( 'Absolute / relative address elements') find_elements_xpath

  2. id positioning (common)

    find_element_id ( 'id attribute value of an element')

    find_elements_id ( 'id attribute value of an element')

  3. class positioning (common)

    find_element_class_name ( 'class attribute value of an element')

    find_elements_class_name ( 'class attribute value of an element')

  4. name Location (common)

    find_element_name ( 'name attribute value of an element')

    find_elements_name ( 'name attribute value of an element')

  5. tag_name (popular)

    find_element_tag_name ( 'element tag name')

    find_elements_tag_name ( 'element tag name')

  6. link_text (exact match <a> text labels)

    find_element_link_text ( 'link text')

    find_elements_link_text ( 'link text')

  7. partial_link_text (partial match <a> label text)

    find_element_partial_link_text ( 'portion of the link text ")

    find_element_partial_link_text ( 'portion of the link text ")

  8. css_selector (individual how not used, are not familiar with)

    find_element_css_selector()

    find_elements_css_selector()

  

  Note: When using find_element element object to be the only, or can not be located

           Query objects can use a plurality of elements find_elements, and returns a list [list]  

 

 

  

  

  

Guess you like

Origin www.cnblogs.com/silenzen/p/12149860.html