码迷,mamicode.com
首页 > Web开发 > 详细

[Selenium] The most commonly used CSSSelector

时间:2015-04-23 15:19:33      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!