- 12
- 0
- 约1.9千字
- 约 11页
- 2017-11-26 发布于河南
- 举报
AutoMan实用教程-Selector用法
AutoMan实用教程 --Selector写法
Automan console
find(/url/,”selector”),返回Array
find_one(/url/,”selector”) ,返回单个元素
show,显示控件
show_path,显示控件及他的父辈
前言
Selector的介绍文档:
/redmine/projects/tam/wiki/%E6%9C%89%E5%85%B3selector%E7%9A%84%E4%B9%A6%E5%86%99
问题:为什么我把element的selector从automan console上抄到平台上,运行脚本却出现无法找到元素呢?
重复定义。子模块写”bodydiv”,控件写”div a”
默认取第一个。“bodydiv a”在console里能找到,但”bodydiv”(submodel)+”a”(element)会找不到
基本用法
示例页面 /
#id
“#title”
.class
“.blur”
element,就是TagName
input”
parentchild
“#logoa”
ancestor descendant
“#site-nav a”
*,代表任何tagname
#J_searchForm*
组合
示例页面 /
层级查找
“#site-nav.login-info a”
多重条件(与)
“input#title.blur” 还可以加属性“input#title.blur[name=q][type=text]”还可以”*[tagname=input][id=title][class=blur][name=q]”
合并结果(或)
“input#title,button”
穿插内容:让我们找找button在哪里?
使用命令:
arr=find(/t/,”button”)
show arr[0]
show arr[1]
HtmlHelper.generate_full_path arr[1]
show_path arr[1]
属性
get_properties方法获得属性的列表
[name=value],属性为value
“input[name=q]”
[name],存在这个属性
“input[id]”
[name^=value],属性要以value开始
“input[id^=tit]”
[name!=value],属性不为value
input[id!=title]
[name$=value],属性以value结尾
input[id$=tle]
[name*=value],属性包含value
“li[class*=menu-item]”
过滤
:eq()
“div.hot li:eq(0)”
:first
“div.hot li:first”
:last
“div.hot li:last”
:even
“div.hot li:even”
: odd
“div.hot li:odd”
: gt()
“div.hot li:gt(1)”
:lt()
“div.hot li:lt(3)”
:not
“div.hot li:not([class])”
内容
: empty
input:empty
: parent
h1:parent
:contains(‘string’),不推荐使用
:has,知道子辈来找他的上辈
“fieldset:has(form#J_searchForm)“-直接儿子
“form:has(input#title)”-子孙
子元素
:first-child
divolli:first-child
:last-child
divolli:last-child
: nth-child
divolli:nth-child(1)“
divolli:nth-child(even)“
divolli:nth-child(odd)”
:only-child
img:only-child
层级
+,(同级)在当前节点后面的元素
示例页面:定位到label后,怎么找后面那个节点input /member/cellphone_register.do?src=nullst=nulltg=nulltu=nullrefuser=nullmzone=null
~,(同级)与当前节点同级的元素
示例页面: /
.search-autobutton~div
您可能关注的文档
- 文档版初中英语词汇表.doc
- 2013卫生A近义词汇总.doc
- 考研英语同源异义形容词归纳(黄涛).doc
- 2014新版新目标七年级下册Unit1can you play the guitar section A课件.ppt
- 管理学原理 --第一章.ppt
- 初中英语单词大全(带音标)1-90.doc
- 2011年职称英语考试单选题常用词对方向预测.doc
- 2013314209张协鎏.docx
- 2015年职称英语考试综合类词义分析(近义词).doc
- 2013会考英语基础词汇分类.doc
- 广东省广州省实验中学教育集团2025-2026学年八年级上学期期中考试物理试题(解析版).docx
- 广东省广州大学附属中学2025-2026学年八年级上学期奥班期中物理试题(解析版).docx
- 广东省广州市第八十六中学2025-2026学年八年级上学期期中物理试题(含答案).docx
- 广东省广州市第八十九中学2025-2026学年八年级上学期期中考试物理试题(解析版).docx
- 广东省广州市第二中学2025-2026学年八年级上学期期中考试物理试题(含答案).docx
- 广东省广州市第八十六中学2025-2026学年八年级上学期期中物理试题(解析版).docx
- 广东省广州市第八十九中学2025-2026学年八年级上学期期中考试物理试题(含答案).docx
- 广东省广州市第二中学2025-2026学年八年级上学期期中考试物理试题(解析版).docx
- 2026《中国人寿上海分公司营销员培训体系优化研究》18000字.docx
- 《生物探究性实验教学》中小学教师资格模拟试题.docx
原创力文档

文档评论(0)