Content reference "Insect Master" books, interested in browse the Bookworm blog: https://home.cnblogs.com/u/fnng/
Basic element positioning
- ID Locator
- Name Locator
- Class positioning
- Tag positioning
- Link positioning
- Partial linkd positioning
- XPath positioning
- CSS Positioning
- By location
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 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 is used to specify the category name of the element;
Expression: Driver.find_elements_by_class_name ("* * *") * * * denotes the specific name of "class"
Content: Slightly
Expression: Find_elements_by_tag_name ()
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)