温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Selenium IDE CSS元素选择器

发布时间:2020-06-29 21:30:07 来源:网络 阅读:1661 作者:13161670059 栏目:软件技术

资源推荐:

视频资源: 软件测试相关系列视频

社区资源: 自动化测试交流群


Css选择器

通过节点属性查找

.class                 选择 class="intro"的所有元素。

#id                     选择 id="firstname"的所有元素。

*                         选择所有元素。

通过节点关系查找

element element             后代选择器

element>element          子元素选择器

element+element          兄弟姊妹选择器

element1~element2       p~ul,选择前面有<p> 元素的每个<ul> 元素。

通过节点属性查找

[attribute]                         [target]   选择带有 target 属性所有元素。

[attribute=value]             [target=_blank]       选择 target="_blank"的所有元素。

[attribute~=value]           [title~=flower]        选择 title 属性包含单词 "flower"的所有元素。

[attribute|=value]           [lang|=en]       选择 lang 属性值以 "en"开头的所有元素。

[attribute^=value]           a[src^="https"]选择其 src 属性值以"https" 开头的每个 <a> 元素。

[attribute$=value]           a[src$=".pdf"] 选择其src 属性以".pdf" 结尾的所有 <a> 元素。

[attribute*=value]           a[src*="abc"] 选择其src 属性中包含"abc" 子串的每个<a> 元素。

伪类选择器

:link                                     a:link                 选择所有链接。

:checked                            input:checked 选择每个被选中的 <input> 元素。

:first-child                         p:first-child      选择属于父元素的第一个子元素的每个 <p> 元素。

:last-child                                   p:last-child      选择属于其父元素最后一个子元素每个<p> 元素。

:first-of-type                    p:first-of-type 选择属于其父元素的首个<p> 元素的每个 <p> 元素。

:last-of-type                     p:last-of-type 选择属于其父元素的最后<p> 元素的每个 <p> 元素。

:only-of-type                    p:only-of-type         选择属于其父元素唯一的<p> 元素的每个 <p> 元素。

:only-child                         p:only-child     选择属于其父元素的唯一子元素的每个 <p> 元素。

:nth-child(n)                      p:nth-child(2)  选择属于其父元素的第二个子元素的每个 <p> 元素。

:nth-last-child(n)              p:nth-last-child(2)   同上,从最后一个子元素开始计数。      

:nth-of-type(n)                 p:nth-of-type(2)      选择属于其父元素第二个<p> 的每个 <p> 元素。

:nth-last-of-type(n)                  p:nth-last-of-type(2)       同上,但是从最后一个子元素开始计数。

 

:input                所有<input> 元素

:text                           所有type="text" 的 <input> 元素

:password        所有 type="password" 的 <input> 元素

:radio                所有type="radio" 的 <input> 元素

:checkbox        所有 type="checkbox" 的 <input> 元素

:submit             所有type="submit" 的 <input> 元素

:reset                所有type="reset" 的 <input> 元素

:button             所有type="button" 的 <input> 元素

:image              所有type="image" 的 <input> 元素

:file                    所有type="file" 的 <input> 元素


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI