AutoMan实用教程-Selector用法.pptxVIP

  • 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

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档