robotframework+selenium2关键字介绍

上传人:ji****en 文档编号:107884096 上传时间:2019-10-21 格式:PDF 页数:66 大小:1.03MB
返回 下载 相关 举报
robotframework+selenium2关键字介绍_第1页
第1页 / 共66页
robotframework+selenium2关键字介绍_第2页
第2页 / 共66页
robotframework+selenium2关键字介绍_第3页
第3页 / 共66页
robotframework+selenium2关键字介绍_第4页
第4页 / 共66页
robotframework+selenium2关键字介绍_第5页
第5页 / 共66页
点击查看更多>>
资源描述

《robotframework+selenium2关键字介绍》由会员分享,可在线阅读,更多相关《robotframework+selenium2关键字介绍(66页珍藏版)》请在金锄头文库上搜索。

1、 RobotFramework-Selenium2Library 中文版 Library Version:V1.6 翻译:代兵,张哲 校对:张哲 日期:2015-04-28 目录目录 介绍 5 测试前提: 6 元素定位: 6 超时等待: 6 引入 Selenium2Library 类库: . 7 常用关键字列表 . 7 验证页面是否包含相应结果 . 7 Page . 7 Location & Title . 8 Text 8 Element . 8 验证页面是否包含相应结果 . 9 List . 9 Checkbox . 9 Radio Button . 9 验证页面是否包含相应结果 . 9

2、Table 9 Xpath . 10 对于页面 AJAX 可以使用如下等待页面的关键词: . 10 和其他界面元素交互的关键词: . 10 Element . 10 List . 10 Checkbox . 11 Radio Button . 11 Form 11 获取页面信息相关关键词: . 11 Page . 11 Element . 11 Link 12 Table 12 List . 12 切换窗口相关关键词: . 12 关键字 13 关键字: Add Cookies . 13 关键字: Alert Should Be Present 13 关键字: Assign Id To Elem

3、ent . 13 关键字: Capture Page Screenshot 14 关键字: Checkbox Should Be Selected . 14 关键字: Checkbox Should Not Be Selected 14 关键字: Choose Cancel On Next Confirmation . 15 关键字: Choose File 15 关键字: Click Button . 15 关键字: Click Element . 16 关键字: Click Element At Coordinates 16 关键字: Click Image 16 关键字: Click L

4、ink 17 关键字: Close All Browsers . 17 关键字: Close Browsers 17 关键字: Close Window . 18 关键字: Confirm Action 18 关键字: Current Frame Contains 19 关键字: Current Frame Should Not Contain . 19 关键字: Create Webdriver 19 关键字: Delete All Cookies . 20 关键字: Delete Cookies 21 关键字: Double Click Element 21 关键字: Drag And D

5、rop . 21 关键字: Drag And Drop By Offset . 22 关键字: Element Should Be Disabled . 22 关键字: Element Should (Not) Be Enable . 22 关键字: Element Should Be Visible . 23 关键字: Element Should Contain 23 关键字: Element Text Should Be 24 关键字: Execute Async Javascript . 24 关键字: Execute Javascript . 25 关键字: Focus . 25 关

6、键字: Frame Should Contain . 25 关键字: Get Alert Message . 26 关键字: Get All Links . 26 关键字: Get Cookie Value . 26 关键字: Get Element Attribute . 27 关键字: Get Horizontal Position . 27 关键字: Get List Items 27 关键字: Get location . 28 关键字: Get Matching Xpath Count 28 关键字: Get Selected List Lable 28 关键字: Get Selec

7、ted List Value 29 关键字: Get Selected List Values 29 关键字: Get Selenium Implicit Wait . 29 关键字: Get Selenium Speed 30 关键字: Get Selenium Timeout 30 关键字: Get Source . 30 关键字: Get Table Cell 31 关键字: Get Text . 31 关键字: Get Title . 32 关键字: Get Value . 32 关键字: Get Vertical Position 32 关键字: Get Window Names 3

8、3 关键字: Get Window Size . 33 关键字: Get Window Size . 33 关键字: Go Back 34 关键字: Go To . 34 关键字: Input Password 34 关键字: Input Text 35 关键字: List Selection Should Be 35 关键字: List Should Hava No Selections . 35 关键字: Location Should Be 36 关键字: Location Should Contain . 36 关键字: Log Location 36 关键字: Locator Sho

9、uld Match X Times 37 关键字: Log Location 37 关键字: Log Source . 37 关键字: Log Title . 38 关键字: Maximize Browser Window 38 关键字: Mouse Down . 38 关键字: Mouse Down On Image . 39 关键字: Mouse Down On Link 39 关键字: Mouse Out. 39 关键字: Mouse Over . 40 关键字: Mouse Up 40 关键字: Open Browser . 40 关键字: Open Context Menu 41 关

10、键字: Page Should (Not) Contain 42 关键字: Page Should (Not) Contain Button 42 关键字: Page Should (Not) Contain Checkbox 42 关键字: Page Should (Not) Contain Element 43 关键字: Page Should (Not) Contain Image . 43 关键字: Page Should (Not) Contain List 44 关键字: Page Should (Not) Contain Radio Button 44 关键字: Page Sho

11、uld (Not) Contain TextField 45 关键字: Press Key 45 关键字: Press Key Native 48 关键字: Press Key Native Radio Button Should (Not) Be Set to 49 关键字: Register Keyword To Run On Failure . 49 关键字: Reload Page . 49 关键字: Select All From List 50 关键字: Select Checkbox 50 关键字: Select All Frame . 50 关键字: Select From L

12、ist . 51 关键字: Select From List List By Index 51 关键字: Select From List List By Label . 52 关键字: Select From List List By Value 52 关键字: Select Radio Button . 52 关键字: Select Window 53 关键字: Set browser implicit wait . 53 关键字: Set Selenium implicit wait . 54 关键字: Set Selenium speed . 54 关键字: Set Selenium

13、Timeout . 55 关键字: Set Window Size 55 关键字: Simulate. 56 关键字: Switch Browser 56 关键字: Table cell should contain . 57 关键字: Table Column should contain 57 关键字: Table Footer should contain 58 关键字: Table Header should contain . 58 关键字: Table Row should contain 59 关键字: Table should Contain . 59 关键字: Textare

14、a Should Contain 60 关键字: Textarea value should be . 60 关键字: Textfield should contain 61 关键字: Textfield Value Should be 61 关键字: Title should be . 61 关键字: Unselect checkbox . 62 关键字: Unselect Frame 62 关键字: Unselect From List . 62 关键字: Unselect From List By Index 63 关键字: Unselect From List By Label . 6

15、3 关键字: Unselect From List By Value 64 关键字: Wait for condition . 64 关键字: Wait Until Element Is Visible . 65 关键字: Wait Until Page Contains . 65 关键字: Wait Until Page Contains Element . 66 关键字: Xpath Should Match X Times 66 介绍介绍 Selenium2Library 是 RobotFramework 针对 web 测试所定义的一套类库文件。 它是使用 selenium2,即 web

16、driver 来模拟操作 web 浏览器的。 你可以访问 http:/seleniumhq.org/docs/03_webdriver.html 来获取更多 selenium2 和 webdriver 的信息。 Selenium2Library 是在真实的浏览器实例中执行测试的。 测试前提: 在使用 Selenium2Library 执行测试前, 必须首先将它引入到你的 Test Suite 中 (可以查看 importing 章节),之后“Open Browser”关键字必须要打开你的预期 URL 路径。 元素定位: Selenium2Library 中的所有关键字都需要通过参数 locator 在 web 页面中进行定位。 默认情况下, 当 一个 locator 值是有效的,它就可以匹配不同页面元素的某些特殊属性。id 和 name 属性可以适用于所有 元素,比如: Click Element my_element 当然,并不是说只能使用 id 和 name 属性来进行定位,在 Selenium2Library 中想去查找某个页面元 素支持多种不同的方式,类型如下: 超时等待:

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 电子/通信 > 综合/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号