First, CSS: property positioning
The 1.CSS can bedirectly anchored to the three general properties of the element's ID,class, and tag.
2. The following is the HTML code of the Baidu input box :
<input id= "kw" class= "S_ipt" type= "text" autocomplete= "Off" maxlength= "+" name= "wd"/>
3.css uses the # sign for label Properties , such as:#kw
for 4.css. represents The class attribute, such as:. S_ipt
5.css directly with the label name, without any identifiers, such as:input
Second, CSS: Other Properties
1.css In addition to the label,class,ID, the three general properties can be located outside, but also through other properties to locate
2. The following are the formats for locating other properties
Third, CSS: label
a 1.css page can be used to position elements by combining labels with attributes
Four, CSS: Hierarchical Relationships
1. in the previous XPath , we talked about hierarchical relationship positioning, where CSS can achieve the same effect
2. such as XPath://form[@id = ' form ']/span/input and //form[@class = ' FM ']/span/input can also be used CSS Implementation
Five, CSS: Index
1. as an example, follow the previous article
2.css can also be indexed by the option:nth-child (1) to locate the child element, which is the XPath The wording is very different, in fact, very good understanding, direct translation came to the first few children
Six, CSS: Logical Operations
1.css can also implement a logical operation, matching two properties, which is not the same as XPath, no need to write the and keyword
Seven, CSS: Fuzzy Matching
1.css Fuzzy matching contains (' xxx '), although the Internet with a variety of data display can be used, but the small part of the test in person, has been an error.
2. after the various Baidu found the answer: youcan ' t does this with the CSS selectors, because there is the no such Thing As:contains () in CSS. It was a proposal the was abandoned years ago. Unfortunately, this syntax has been abandoned, so there is no further research.
CSS positioning of Selenium+python automation