Webdriver API element Positioning (i)

Source: Internet
Author: User

Content reference "Insect Master" books, interested in browse the Bookworm blog: https://home.cnblogs.com/u/fnng/

  Basic element positioning

    1. ID Locator
    2. Name Locator
    3. Class positioning
    4. Tag positioning
    5. Link positioning
    6. Partial linkd positioning
    7. XPath positioning
    8. CSS Positioning
    9. By location

    • ID Locator

The HTML rule id attribute must be unique in the HTML document and is very unique, and webdriver can find the element by looking up the id attribute;

Expression: find_element_by_id ("* * *") * * * indicates the specific name of the ID

    • Name Locator

Name is used to specify the names of the elements, and the property values of name are not unique and should be used with caution when using positioning.

Expression: Find_element_by_name ("* * *") * * * indicates the specific name of "name"

Pan out: Find_elements_by_name ("* * *") means to find multiple "* * *", when not adding S, the default return to the first element found

    • Class positioning

 Class is used to specify the category name of the element;

Expression: Driver.find_elements_by_class_name ("* * *") * * * denotes the specific name of "class"

  

    • Tag positioning

 Content: Slightly

Expression: Find_elements_by_tag_name ()

    • Link positioning

  Link locates elements by using the element tag to position the previous text information.

Expression: Find_elements_by_link_text ("* * *") * * * indicates the exact name of the text

  

    • Partial linkd positioning

Partial linkd Positioning is a supplement to link positioning, which is a kind of positioning for long text

Webdriver API element Positioning (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.