



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Web AUTOTEST API使用文档注释:#跟id默认是css,可以跟多个class样式,用.串联:text = 保存 二层判断1、visit(url)导航到指定的URL,该URL可以是相对URL或绝对URL。visit(/foo)visit()Capybara.app_host = #具体地址在配置文件中设置时,框架中可以简写成如下格式:visit(/) # visits the google homepage2、Clicking links and buttonsclick_link(id-of-link)#参数为a button by id, text or valueclick_link(Link Text)click_button(Save)#参数为:a link by id or textclick_on(Link Text) #参数为以上2者都可click_on(Button Value)3、Interacting with formsfill_in(First Name, :with= John)fill_in(Password, :with= Seekrit) fill_in(Description, :with= Really Long Text.) # Locate a text field or text area and fill it in with the given text The field can be found via its name, id or label text.choose(A Radio Button)# a radio button and mark it as checked.check(A Checkbox)# a check box and mark it as checked.uncheck(A Checkbox)# a check box and mark uncheck it.attach_file(Image, /path/to/image.jpg)# find a file field on the page and attach a file given its path.select(Option, :from= Select Box)# Find a select box on the page and select a particular option from it.例子:find(div.datagrid-view2).find(tr,:text = 综合管理部测试).check(department_id)4、Queryingpage.has_selector?(table tr)page.has_selector?(:xpath, /table/tr)# Checks if a given selector is on the page or current nodepage.has_no_selector?(:content)# Checks if a given selector is not on the page or current nodepage.has_xpath?(/table/tr)# Checks if a given XPath expression is on the page or current node.page.has_css?(table tr.foo) #Checks if a given CSS selector is on the page or current node.page.has_text?(lorem ipsum, between: 2.4)# Checks if the page or current node has the given text content, ignoring any HTML tags and normalizing whitespace.例子:find(tr,text:家乐福).has_text?(家乐福)5、Findingfind_field(First Name).value #Find a form field on the page.find_link(Hello).visible? #Find a link on the page.find_button(Send).click #Find a button on the page.find(:xpath, /table/tr).clickfind(#overlay).find(h1).click #Find an Element based on the given arguments.all(a).each |a| a:href #Find all elements on the page matching the given selector and options.例子:find(bobox-item, :text = 酷派8150).clickfind(bo-panel.panel-body.panel-body-noheader).find(bobox-item, :text = 华为Ascend D1).clickfind(textarea#checkOpinion).set 通过all(bo-text.validatebox-text)0.set 2013-11-07all(bo-arrow)2.click6、Scopingwithin(li#employee) dofill_in Name, :with= Jimmyendwithin(:xpath, /liid=employee) dofill_in Name, :with= Jimmyendwithin_table(Employee) dofill_in Name, :with= Jimmyend例子:within_frame(frame销售明细) doclick_link(查询)endwithin_frame(frame订货管理) do find(bo-arrow).click find(bobox-item,:text = 已审核).click find(textarea#checkOpinion).set 通过 end7、Scriptingpage.execute_script($(body).empty()execute_script $(#roleCombo).combobox(setValue, #hash角色.to_s)8、TABLEtable.hashes.each do |hash|drop_n
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 开心一刻 吉他秀教学设计初中音乐八年级上册沪教版
- 第四章 隋唐时期社会概况和文化说课稿-2025-2026学年中职基础课-中国历史(全一册)-人教版-(历史)-60
- 2025店铺租赁合同协议范本
- 北师大版小学语文六年级下册学步教案教学设计(2025-2026学年)
- 食材配送合同
- 9.讲好自己的故事-以《我的梦想》为例教你写演讲稿(说课稿)-《演讲与口才》同步备课
- Unit 1Topic 3说课稿 -2024-2025学年仁爱科普版英语八年级上册
- 一、话中秋教学设计小学综合实践活动六年级上册鲁科版
- 2025年二手购房合同范本简化版
- 2025级混凝土材料采购合同
- 低碳时代下冷链物流配送路径的深度优化与实践
- 潮汕英歌舞完整版本
- 医院信息安全管理制度培训
- 建立分公司策划方案
- 2025年云南省中考英语试卷真题(含标准答案)
- 2025年三环集团招聘笔试冲刺题(带答案解析)
- 中国外运笔试题及答案
- 芯片供应战略合作协议书
- DB31/T 796-2014节能改造服务规范
- 2025年中国电子游戏室市场调查研究报告
- 部队土方代建合同协议
评论
0/150
提交评论