标签:
CSSSelector |
Example |
Description |
element.element |
div.dropdown |
Select all <div> elements whose class=“dropdown” |
element#element |
div#new-input |
Select all <div> elements whose id =“new-input” |
element element |
div p |
Select all <p> elements who are under <div> element |
element>element |
div>p |
Select all <p> elements whose father is <div> element |
[attribute] |
div[rowid] |
Select all <div> elements who has attribute rowid |
[attribute=value] |
input[value=‘OK‘] |
Select all <input> elements whose attribute value is ‘OK’ |
[attribute*=value] |
a[src*=‘abc’] |
Select all <a> elements whose attribute src contains ‘abc’ |
:nth-child(n) |
p:nth-child(2) |
Select all <p> elements who is the second child of its father |
eg 1: div.rtq-grid-row[rowid] div.rtq-grid-cell:nth-child(5) a
eg 2: div#fileUpDiv input[value=‘OK‘]
[Selenium] The most commonly used CSSSelector
标签:
原文地址:http://www.cnblogs.com/feifeidxl/p/4450511.html