*** Settings ***
Library Selenium2Library

*** Keywords ***
Checkbox应该不被选择
[Arguments] ${locator}
Checkbox Should Not Be Selected ${locator}

Frame应该包含文本
[Arguments] ${locator} ${text} ${loglevel}=INFO
Frame Should Contain ${locator} ${text} ${loglevel}

List应该无选项
[Arguments] ${locator}
List Should Have No Selections ${locator}

List选项应该是
[Arguments] ${locator} @{items}
List Selection Should Be ${locator} @{items}

Radio按钮不应该被选择
[Arguments] ${group_name}
Radio Button Should Not Be Selected ${group_name}

Radio按钮应该被设置成
[Arguments] ${group_name} ${value}
Radio Button Should Be Set To ${group_name} ${value}

Url应该包含
[Arguments] ${expected}
Location Should Contain ${expected}

Xpath应该匹配X次
[Arguments] ${xpath} ${expected_xpath_count} ${msg}= ${loglevel}=INFO
Xpath Should Match X Times ${xpath} ${expected_xpath_count} ${msg} ${loglevel}

checkbox应该被选择
[Arguments] ${locator}
checkbox should be selected ${locator}

url应该是
[Arguments] ${url}
Location Should Be ${url}

下次确认选择取消
Choose Cancel On Next Confirmation

下次确认选择确定
Choose Ok On Next Confirmation

从List中取消选项
[Arguments] ${locator} @{items}
Unselect From List ${locator} @{items}

从List选择选项
[Arguments] ${locator} @{items}
Select From List ${locator} @{items}

偏移拖拽
[Arguments] ${source} ${xoffset} ${yoffset}
Drag And Drop By Offset ${source} ${xoffset} ${yoffset}

元素应该不包含文本
[Arguments] ${locator} ${expected} ${msg}=
Element Should Not Contain ${locator} ${expected} ${msg}

元素应该不可用
[Arguments] ${locator}
Element Should Be Disabled ${locator}

元素应该不可见
[Arguments] ${locator} ${msg}=
Element Should Not Be Visible ${locator} ${msg}

元素应该包含文本
[Arguments] ${locator} ${text}
Element Should Contain ${locator} ${text}

元素应该匹配x次
[Arguments] ${locator} ${count} ${msg}= ${loglevel}=INFO
Locator Should Match X Times ${locator} ${count} ${msg} ${loglevel}

元素应该可用
[Arguments] ${locator}
Element Should Be Enabled ${locator}

元素应该可见
[Arguments] ${locator}
Element Should Be Visible ${locator}

元素文本应该是
[Arguments] ${locator} ${expected} ${msg}=
Element Text Should Be ${locator} ${expected} ${msg}

全选List元素
[Arguments] ${locator}
Select All From List ${locator}

关闭所有浏览器
Close All Browsers

关闭浏览器
Close Browser

关闭窗口
Close Window

切换浏览器
[Arguments] ${index}
Switch Browser ${index}

创建Webdriver
[Arguments] ${driver_name} ${alias}= ${kwargs}={}
Create Webdriver ${driver_name} ${alias} ${kwargs}

删除Cookie
[Arguments] ${name}
Delete Cookie ${name}

删除所有Cookie
Delete All Cookies

删除本地策略
[Arguments] ${strategy_name}
Remove Location Strategy ${strategy_name}

刷新页面
Reload Page

双击元素
[Arguments] ${locator}
Double Click Element ${locator}

取消选择Checkbox
[Arguments] ${locator}
Unselect Checkbox ${locator}

取消选择Frame
Unselect Frame

回退
Go Back

在图片上按下鼠标左键
[Arguments] ${locator}
Mouse Down On Image ${locator}

在连接上按下鼠标左键
[Arguments] ${locator}
Mouse Down On Link ${locator}

应该出现警告弹窗
[Arguments] ${text}=
Alert Should Be Present ${text}

当前Frame不应该包含
[Arguments] ${text} ${loglvl}=INFO
Current Frame Should Not Contain ${text} ${loglvl}

当前Frame包含
[Arguments] ${text} ${loglevel}=INFO
Current Frame Contains ${text} ${loglevel}

截屏
[Arguments] @{filename}
Capture Page Screenshot @{filename}

打开浏览器
[Arguments] ${url} ${browser}=chrome @{args}
Open Browser ${url} ${browser} @{args}

打开菜单
[Arguments] ${locator}
Open Context Menu ${locator}

执行js
[Arguments] ${code}
Execute Javascript ${code}

执行异步js
[Arguments] ${code}
Execute Async Javascript ${code}

拖拽元素
[Arguments] ${source} ${target}
Drag And Drop ${source} ${target}

按下鼠标左键
[Arguments] ${locator}
Mouse Down ${locator}

按键
[Arguments] ${locator} ${key}
[Documentation] 按键 \ \ text_field \ \ q
...
... 按键 \ \ login_button \ \\13 \ \ #ASCII Code for enter Key
Press Key ${locator} ${key}

提交表单
[Arguments] ${locator}=
Submit Form ${locator}

文本区值应该是
[Arguments] ${locator} ${expected} ${msg}=
Textarea Value Should Be ${locator} ${expected} ${msg}

文本区应该包含
[Arguments] ${locator} ${expected} ${msg}=
Textarea Should Contain ${locator} ${expected} ${msg}

文本框值应该是
[Arguments] ${locator} ${expected} ${msg}=
Textfield Value Should Be ${locator} ${expected} ${msg}

文本框应该包含
[Arguments] ${locator} ${expected} ${msg}=
Textfield Should Contain ${locator} ${expected} ${msg}

最大化
Maximize Browser Window

标题应该是
[Arguments] ${title}
Title Should Be ${title}

根据Index从List中取消选项
[Arguments] ${locator} @{indexes}
Unselect From List By Index ${locator} @{indexes}

根据Index从List选择
[Arguments] ${locator} @{indexes}
Select From List By Index ${locator} @{indexes}

根据Label从List中取消选项
[Arguments] ${locator} @{Labels}
Unselect From List By Label ${locator} @{Labels}

根据Label从List选择
[Arguments] ${locator} @{labels}
Select From List By Label ${locator} @{labels}

根据Value从List中取消选项
[Arguments] ${locator} @{values}
Unselect From List By Value ${locator} @{values}

根据Value从List选择
[Arguments] ${locator} @{values}
Select From List By Value ${locator} @{values}

根据值选择列表元素
[Arguments] ${locator} ${value}
Select From List By Value ${locator} ${value}

模拟
[Arguments] ${locator} ${event}
Simulate ${locator} ${event}

注册失败后运行的关键字
[Arguments] ${kwd}
Register Keyword To Run On Failure ${kwd}

添加cookie
[Arguments] ${name} ${value} ${path}= ${domain}= ${secure}= ${expiry}=

添加本地策略
[Arguments] ${strategy_name} ${strategy_keyword} ${persist}=False
Add Location Strategy ${strategy_name} ${strategy_keyword} ${persist}

清除元素文本
[Arguments] ${locator}
Clear Element Text ${locator}

点击元素
[Arguments] ${path}
Click Element ${path}

点击元素坐标
[Arguments] ${locator} ${xoffset} ${yoffset}
Click Element At Coordinates ${locator} ${xoffset} ${yoffset}

点击图片
[Arguments] ${locator}
Click Image ${locator}

点击按钮
[Arguments] ${path}
Click Button ${path}

点击链接
[Arguments] ${locator}
Click Link ${locator}

睡眠
[Arguments] ${time}
Sleep ${time}

确认
Confirm Action

窗口列表
@{list} List Windows
[Return] @{list}

等待元素不包含文本
[Arguments] ${locator} ${text} ${timeout}= ${error}=
Wait Until Element Does Not Contain ${locator} ${text} ${timeout} ${error}

等待元素不可见
[Arguments] ${locator} ${timeout}= ${error}=
Wait Until Element Is Not Visible ${locator} ${timeout} ${error}

等待元素包含文本
[Arguments] ${locator} ${text} ${timeout}= ${error}=
Wait Until Element Contains ${locator} ${text} ${timeout} ${error}

等待元素可用
[Arguments] ${locator} ${timeout}= ${error}=
Wait Until Element Is Enabled ${locator} ${timeout} ${error}

等待元素可见
[Arguments] ${locator} ${timeout}=30
Wait Until Element Is Visible ${locator} ${timeout}

等待执行成功
[Arguments] ${timeout} ${retry} ${keyword} @{args}
Wait Until Keyword Succeeds ${timeout} minutes ${retry} sec ${keyword} @{args}

等待条件成立
[Arguments] ${condition} ${timeout}= ${error}=
Wait For Condition ${condition} ${timeout} ${error}

等待页面不包含元素
[Arguments] ${locator} ${timeout}= ${error}=
Wait Until Page Does Not Contain Element ${locator} ${timeout} ${error}

等待页面包含元素
[Arguments] ${locator} ${timeout}= ${error}=
Wait Until Page Contains Element ${locator} ${timeout} ${error}

等待页面包含文本
[Arguments] ${text} ${timeout}= ${error}=
Wait Until Page Contains ${text} ${timeout} ${error}

给元素分配ID
[Arguments] ${locator} ${id}
Assign Id To Element ${locator} ${id}

获取Cookie值
[Arguments] ${name}
${value} Get Cookie Value ${name}
[Return] ${value}

获取List元素
[Arguments] ${locator}
@{items} Get List Items ${locator}

获取List多个选定值
[Arguments] ${locator}
@{values} Get Selected List Values ${locator}
[Return] @{values}

获取List多个选定标签
[Arguments] ${locator}
@{labels} Get Selected List Labels ${locator}
[Return] @{labels}

获取List选定值
[Arguments] ${locator}
${value} Get Selected List Value ${locator}
[Return] ${value}

获取List选定标签
[Arguments] ${locator}
${label} Get Selected List Label ${locator}
[Return] ${label}

获取Selenium等待时间
${sec} Get Selenium Implicit Wait
[Return] ${sec}

获取Selenium超时
${timeout} Get Selenium Timeout
[Return] ${timeout}

获取Selenium速率
${res} Get Selenium Speed
[Return] ${res}

获取xpath匹配次数
[Arguments] ${xpath}
${count} Get Matching Xpath Count ${xpath}
[Return] ${count}

获取元素值
[Arguments] ${locator}
${value} Get Value ${locator}
[Return] ${value}

获取元素属性
[Arguments] ${attribute_locator}
Get Element Attribute ${attribute_locator}

获取元素文本
[Arguments] ${locator}
${text} Get Text ${locator}
[Return] ${text}

获取坐标
${location} Get Location
[Return] ${location}

获取垂直坐标
[Arguments] ${locator}
${vertical} Get Vertical Position ${locator}
[Return] ${vertical}

获取当前Url
${url} Log Location
[Return] ${url}

获取当前页面标题
${title} Log Title
[Return] ${title}

获取所有Cookie
@{cookies} Get Cookies
[Return] @{cookies}

获取所有连接
@{links} Get All Links
[Return] @{links}

获取文本
[Arguments] ${path}
${text} get text ${path}
[Return] ${text}

获取标题
${title} get title
[Return] ${title}

获取水平坐标
[Arguments] ${locator}
@{position} Get Horizontal Position ${locator}
[Return] @{position}

获取焦点
[Arguments] ${locator}
Focus ${locator}

获取窗口名字
@{names} Get Window Names
[Return] @{names}

获取窗口坐标
${x} ${y}= Get Window Position
[Return] ${x} ${y}

获取窗口大小
${width} ${higth}= GET Window Size
[Return] ${width} ${higth}

获取窗口标识
@{windows} Get Window Identifiers
[Return] @{windows}

获取窗口标题
@{titles} Get Window Titles
[Return] @{titles}

获取表格内容
[Arguments] ${table_locator} ${row} ${column} ${loglevel}=INFO
${cell} Get Table Cell ${table_locator} ${row} ${column} ${loglevel}
[Return] ${cell}

获取警告信息
${msg} Get Alert Message
[Return] ${msg}

获取资源
${source} Get Source
[Return] ${source}

获取页面元素
[Arguments] ${locator}
@{elements} Get Webelements ${locator}
[Return] @{elements}

获取页面标题
${title} Get Title
[Return] ${title}

获取页面资源
[Arguments] ${loglevel}=INFO
${source} Log Source ${loglevel}
[Return] ${source}

表头应该包含
[Arguments] ${table_locator} ${expected} ${loglevel}=INFO
table header should contain ${table_locator} ${expected} ${loglevel}

表头应该包含文本
[Arguments] ${table_locator} ${expected} ${loglevel}=INFO
Table Header Should Contain ${table_locator} ${expected} ${loglevel}

表应该包含文本
[Arguments] ${table_locator} ${expected} ${loglevel}=INFO
Table Should Contain ${table_locator} ${expected} ${loglevel}

表格Footer应该包含文本
[Arguments] ${table_locator} ${expected} ${loglevel}
Table Footer Should Contain ${table_locator} ${expected} ${loglevel}

表格列应该包含文本
[Arguments] ${table_locator} ${col} ${expected} ${loglevel}=INFO
Table Column Should Contain ${table_locator} ${col} ${expected} ${loglevel}

表格应该包含
[Arguments] ${table_locator} ${row} ${column} ${expected}
table cell should contain ${table_locator} ${row} ${column} ${expected}

表格应该包含文本
[Arguments] ${table_locator} ${row} ${column} ${expected} ${loglevel}=INFO
Table Cell Should Contain ${table_locator} ${row} ${column} ${expected} ${loglevel}

表格行应该包含文本
[Arguments] ${table_locator} ${row} ${expected} ${loglvl}=INFO
Table Row Should Contain ${table_locator} ${row} ${expected} ${loglvl}

设置Selenium等待
[Arguments] ${seconds}
${return} Set Selenium Implicit Wait ${seconds}
[Return] ${return}

设置Selenium超时
[Arguments] ${seconds}
Set Selenium Timeout ${seconds}

设置Selenium速率
[Arguments] ${speed}
Set Selenium Speed ${speed} seconds

设置浏览器等待时间
[Arguments] ${seconds}
Set Browser Implicit Wait ${seconds}

设置窗口坐标
[Arguments] ${x} ${y}
Set Window Position ${x} ${y}

设置窗口大小
[Arguments] ${width} ${higth}
Set Window Size ${width} ${higth}

跳转
[Arguments] ${url}
Go To ${url}

跳转到
[Arguments] ${url}
go to ${url}

输入密码
[Arguments] ${path} ${passwd}
Input password ${path} ${passwd}

输入文本
[Arguments] ${path} ${str}
Input Text ${path} ${str}

选择Checkbox
[Arguments] ${locator}
Select Checkbox ${locator}

选择Frame
[Arguments] ${locator}
Select Frame ${locator}

选择Radio按钮
[Arguments] ${group_name} ${value}
Select Radio Button ${group_name} ${value}

选择文件
[Arguments] ${locator} ${file_path}
Choose File ${locator} ${file_path}

选择窗口
[Arguments] ${locator}=
Select Window ${locator}

页面应该不包含Checkbox
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Checkbox ${locator} ${msg} ${loglevel}

页面应该不包含Link
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Link ${locator} ${msg} ${loglevel}

页面应该不包含List
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain List ${locator} ${msg} ${loglevel}

页面应该不包含Radio按钮
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Radio Button ${locator} ${msg} ${loglevel}

页面应该不包含元素
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Element ${locator} ${msg} ${loglevel}

页面应该不包含图片
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Image ${locator} ${msg} ${loglevel}

页面应该不包含按钮
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Button ${locator} ${msg} ${loglevel}

页面应该不包含文本
[Arguments] ${text} ${lvl}=INFO
Page Should Not Contain ${text} ${lvl}

页面应该不包含文本框
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Textfield ${locator} ${msg} ${loglevel}

页面应该包含Checkbox
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Checkbox ${locator} ${msg} ${loglevel}

页面应该包含Link
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Link ${locator} ${msg} ${loglevel}

页面应该包含List
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain List ${locator} ${msg} ${loglevel}

页面应该包含Radio按钮
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Radio Button ${locator} ${msg} ${loglevel}

页面应该包含元素
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Element ${locator} ${msg} ${loglevel}

页面应该包含图片
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Image ${locator} ${msg} ${loglevel}

页面应该包含按钮
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Button ${locator} ${msg} ${loglevel}

页面应该包含文本
[Arguments] ${text} ${loglevel}=INFO
Page Should Contain ${text} ${loglevel}

页面应该包含文本框
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Textfield ${locator} ${msg} ${loglevel}

鼠标悬停
[Arguments] ${locator}
Mouse Over ${locator}

鼠标移出
[Arguments] ${locator}
Mouse Out ${locator}

鼠标释放
[Arguments] ${locator}
Mouse Up ${locator}

---------------------
作者:assless
来源:CSDN
原文:https://blog.csdn.net/jasonliujintao/article/details/54600365
版权声明:本文为博主原创文章,转载请附上博文链接!

RobotFramework Selenium2 关键字的更多相关文章

  1. robotframework日志输出中文乱码以及robotframework常用关键字-笔者亲测

    一.环境说明 python版本:3.7.3 robotframework版本:3.1 robotframwork-ride版本:1.7.4.2 二.问题描述

  2. robotframework常用关键字

    robotframework关键字 可以将关键字看作是处理数据的方法.robotframework的关键字和测试数据组成了测试用例. robotframework关键字包括系统关键字和用户关键字.用户 ...

  3. 贯穿RobotFramework框架 - 关键字(一) 最全面的疏理

    在RF中,关键字是一个非常重要的存在.想做任何事情,都是通过关键字来实现的. 这篇文章对RobotFramework中的关键字做个整理.大概分为以下几点内容: 1.什么是关键字 2.关键字来自哪里.有 ...

  4. RobotFramework+Selenium2+Appium环境搭建

    转载:https://www.cnblogs.com/testway/p/7372326.html 装python 2.7 RobotFramework是python2 写的,图形界面使用的wxpyt ...

  5. robotframework Selenium2+RFS自动化测试

    支持浏览器版本:Google Chrome (64位) 52.0.2743.82 正式版 52.0.2743.6_chrome_installer 64位 下载地址:http://www.online ...

  6. RobotFramework+Selenium2环境搭建与入门实例

    一.安装包 1.Python(推荐使用ActivePython,这个版本PATH已经配好了,也安了一些像pip这样的包) ActivePython-2.7.2.5-win32-x86.msi 2.Wx ...

  7. robotframework用户关键字创建过程

    robotframework是一个关键字驱动框架,核心在于关键字的应用.系统本身通过各种库自带了大量关键字,同时支持用户自定义关键字.关键字可以简单理解为各种处理数据的方法. 关键字区别与用户参数. ...

  8. RobotFramework+Selenium2软件安装教程

    1.安装python 必须是 2.7 版本    设置环境变量:F:\software\Python27;F:\software\Python27\Scripts;    重启电脑: 2.安装wxPy ...

  9. 解决RobotFramework的关键字不能高亮的问题

    一个可能的原因:路径中存在汉字,RobotFramework对这方面运行的不太好.

随机推荐

  1. java之JVM(二)

  2. RePr: Improved Training of Convolutional Filters

    关键点: 1.关于filter正交 将一层中的一个$k \times k \times c$的卷积核展开为$k * k * c$的向量,表示为$f$.一层中有$J_{\ell}$个卷积核,$\bold ...

  3. mysql 表关联批量更新

    项目中最近遇到了需要手动修改某个表的某个字段的数据,但是这个数据是来自别的表,需要关联,所以需要用到关联的批量更新,特此记录一下. UPDATE t_account_trans_info AS iiI ...

  4. java Arrays.asList方法注意事项

    1. 简介 Arrays.asList()方法可以将数组转化为长度固定的列表. 该方法强调了列表的长度是固定的,因此不能使用list的add和remove方法修改list长度. 2. 示例 impor ...

  5. iOS 性能优化总结

    卡顿产生的原因 在 VSync信号到来后,系统图形服务会通过 CADisplayLink等机制通知 App,App主线程开始在 CPU中计算显示内容,比如视图的创建.布局计算.图片解码.文本绘制等.随 ...

  6. 学号 2018-2019-20175212 实验一 《Java开发环境的熟悉》

    学号 2018-2019-20175212 实验一 <Java开发环境的熟悉> 一.实验内容及步骤 1.使用JDK编译.运行简单的Java程序 mkdir 20175212exp1创建20 ...

  7. leetcode 链表相关

    1.给出两个 非空 的链表用来表示两个非负的整数.其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字. 如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们 ...

  8. Kafka分布式消息队列

    基本架构 Kafka分布式消息队列的作用: 解耦:将消息生产阶段和处理阶段拆分开,两个阶段互相独立各自实现自己的处理逻辑,通过Kafka提供的消息写入和消费接口实现对消息的连接处理.降低开发复杂度,提 ...

  9. WEEK1

    #变量 var1: name = input('name:') age = input('age:) job = input('job:) salary = input('salary:) info ...

  10. 封装一个redis操作类来操作hash格式

    最近项目要用redis,依然是基于tp3.2. 发现thinkphp3.2自带的缓存类并不好使用,就自己封装了一个 目前只支持hash格式,其他数据类型的操作后面用到的时候再补充 <?php / ...