我爱编程

selenium-css定位

2018-05-23  本文已影响0人  往你头上敲三下

1、*:checked  选中*的checked元素

2、 li.refined.list.group.item (如果class中间有空格,可以.+.+.全写也可以只写任意一个)

    .checkbox[type^='check'][onclick*='Bebe'][checked$='ed'] +a

    (开头^=   包含*=   结尾$= )+a 是选中同级的后面的a

3、 li a        :选中 li 标签的后代 a

5、 li>a       :选中 li 标签的子元素 a

4、 li,a        :选中 li 和 a

5、 li +a      :选中 li 同级的 下一个 a

6、 li ~a       :选中 li 同级的 下面所有的 a

7、 li>a:last-child  /  li>a:last-of-type  : 选中 li 下最后面一个 a

8、 li:not([class*='_'])    : li 中的 calss 不含 '_' 

      li:not(:nth-of-type(1))    : 不含第一个 li 的所有 li

9、 li>a:nth-child(n)   /  li>a:nth-of-type(n) :选中 li 下第 n 个 a

      li>a:nth-last-child(n)   /  li>a:nth-last-of-type(n):选中 li 下,倒数第 n 个 a

    如果 n = odd 表示奇数

    如果 n = even 表示偶数

div h2:nth-child(n) : 当div的第n个子元素是h2的时候

div h2:nth-of-type(n):   div下第n个h2子元素

10、 div[style]     : div中包含 属性style 

11、 li>a:only-child      :li 下只有1个a的 a 标签

上一篇 下一篇

猜你喜欢

热点阅读