How to use the ==>css selector of selenium learning

Source: Internet
Author: User

First, what is CSS Selector

CSS selector positioning is actually the HTML CSS selector tag positioning

Tools

Css Selector's exercises suggest that you install Firefox, download plugins, Firefinder or Firebug and firepath combinations.

Second, Css selector use method

1, through the ID, class positioning

1 ID Locator 2 #号代表id, it is more concise to locate the label with ID 3 #i1 4 5 class positioning 6 . Represents class 7 . C1 8 class positioning also provides multiple class positioning, through continuous. To narrow the range 9 . c1.c2.c3

2, through the label positioning

1 Positioning method: Directly enter the label name 2 Div 3 input 4 alone with no effect, because a page the same label too much, need and other ways together with

3, through the property positioning

12     [name= ' N1 ']

4. Positioning by combination of tag attributes

1 Tag Attribute combination 2 input[name= ' N1 '] 3 4 tag and class combination 5 Input.c1 6 7 combination of tag and ID 8 Input#i1

5. Through multi-attribute combination

1 CSS Selector Multi-attribute combination selection filter without and only requires multiple [] connections to 2 select[name= ' City '][size= ' 4 '][multiple= "multiple"]

6, through the hierarchical relationship positioning

1 different Css selector with XPath to differentiate hierarchy by > 2 select>option[value= ' 3 ']

7. Fuzzy Matching

1 ^= match element properties start with what 2 [placeholder^= ' Please enter '] 3 4 $= What does the match attribute end with? 5 [placeholder$= ' element '] 6 7 *= Match property contains what value input 8 [placeholder*= ' ID ']

How to use the ==>css selector of selenium learning

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.