首页 > Web开发 > 详细

[Selenium] The most commonly used CSSSelector

时间:2015-04-23 15:18:40      阅读:282      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!