https://blog.csdn.net/yu1014745867/article/details/79324732
常用关键字
* Settings *
Library Selenium2Library
1
* Keywords *
打开浏览器
[Arguments] ${url} ${browser}
[Documentation] 打开浏览器
open browser ${url} ${browser}
1
2
3
最大化窗口
[Documentation] 最大化窗口
Maximize Browser Window
1
2
等待时间
[Arguments] ${time}
[Documentation] 等待时间
sleep ${time}
1
2
3
文本框输入
[Arguments] ${location} ${value}
[Documentation] 文本框输入
input text ${location} ${value}
1
2
3
点击按钮
[Arguments] ${location}
[Documentation] 点击按钮
click button ${location}
1
2
3
点击元素
[Arguments] ${location}
[Documentation] 点击元素
click element ${location}
1
2
3
点击链接
[Arguments] ${location}
[Documentation] 点击链接
click link ${location}
1
2
3
鼠标滑动
[Arguments] ${location}
[Documentation] 鼠标滑动
mouse over ${location}
1
2
3
截图
[Documentation] 截图
Capture Page Screenshot
1
2
执行js
[Arguments] ${JSContent}
[Documentation] 执行JS
Execute JavaScript ${JSContent}
1
2
3
选择Frame
[Arguments] ${location}
[Documentation] 选择Frame
Select Frame ${location}
1
2
3
等待元素
[Arguments] ${location} ${time} ${error} # 元素|等待时间|输出错误
[Documentation] 等待元素
wait until element is visible ${location} ${time} ${error}
1
2
3
4
勾选框
[Arguments] ${location}
[Documentation] 勾选框
Select Checkbox ${location}
1
2
3
单选框
[Arguments] ${group} ${value}
[Documentation] 单选框
Select Radio Button ${group} ${value}
1
2
3
复选框选择
[Arguments] ${type} ${location} @{value} # type:label、value,按照label还是value来定位,默认为label
[Documentation] 复选框选择
run keyword if ${type}=='value' Select From List By value ${location} @{value}
else Select From List By label ${location} @{value}
[Teardown]
1
2
3
4
5
下拉框选择
[Arguments] ${type} ${location} @{value} # type:label、value,按照label还是value来定位,默认为label
[Documentation] 下拉框选择
run keyword if ${type}=='value' Select From List By value ${location} @{value}
else Select From List By label ${location} @{value}
[Teardown]
1
2
3
4
5
判断文本正确性
[Arguments] ${location} ${expected}
[Documentation] 判断文本正确性
element text should be ${location} ${expected}
1
2
3
循环
if循环
Run Keyword If '${addr.status_code}' == '200' Log 接口返回状态码正常
... ELSE Log 接口返回状态码错误!
————————————————
版权声明:本文为CSDN博主「ElenaYu」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yu1014745867/article/details/79324732