RFS自动化测试工具安装与使用总结
转载:http://blog.csdn.net/a5650892/article/details/77826021
一,调试
1,在调试时,总时提示“无法打开浏览器”
解决办法:
1,把浏览器的代理关闭
2,把浏览器的显示比例调到100%
3,在IE设置的安全选项中,把启用保护模式开启
4,去除进入系统弹出的登录提示
在浏览器中---工具---internet选项---安全---把只在intranet自动登录,改为匿名登录
二,安装加载库
1,RequestsLibrary
先安装Requests工具,再安装RequestsLibrary
再在robot中进行加载lib,如果加载的库还是红色的,重启就可以了
三,常用关键字
open browser 打开浏览器
input text 在文本框中录入内容
input password 在文本框中录入密码
click button 点击按钮
page should (NOT)contain (link,button,element,checkbox,list) 页面是否出现指定的内容
close browser 关闭浏览器
多个打开浏览器切换
open browser http://127.0.0.1:8000/ ie local
switch browser local
针对页面弹出窗口的确认键
confirm action----类似于点击弹出窗的确认或OK键
alert should be present 当前弹窗的内容 -----判断当前指定内容的弹窗是否存在
get alert message---获取弹出窗的信息
${msg}= get alert message
should be equal as string ${msg} *****
在弹窗中选择取消操作
a,choose cancle on next confirmaction
b,confirm action
设置日志级别
Set Log Level TRACE
下拉列表
select from list xpath value
select from list by value xpath value
select from list by index xpath value
框架
select frame id=fra
unselect frame
复选框
select checkbox id=CheckYes
unselect checkbox id=CheckNo
checkbox should not be selected
select checkbox
checkbox should be selected
单选框
select radio button radio1---单选框名称 A--value)
click element id=registerGenderMale
Oracle数据库
connect to database using custom params(关键字) cx_Oracle 用户名,密码,SID
${row} row count select * from 表1;
等待页面加载
wait until page contains element
sleep
reload page---刷新
注释
Comment
几个关键字的区别
Wait Until Keyword Succeeds
wait until page contains element
SLEEP
element should contain
page should contain element
page should contain
Element Should Not Be Visible
判断的使用
判断条件---数字对比
Run Keyword If ${res} == 0 执行的关键字
... ELSE 执行的关键字2
判断条件---字符对比
Run Keyword If ‘${res}’ == ‘ttttt' 执行的关键字
判断条件---布尔类型对比
Run Keyword If '${res}' == '${true}' 执行的关键字
HTTP接口
create session httpserver http://localhost:8000
${addr} Get request httpserver users/s
should be equal as strings ${addr.status_code} 200
log ${addr.content}
${resp} tojson ${addr.content}
四,常见问题解答
1,定位不到元素
Element locator '//input[@id="registerName"]' did not match any elements.
前端代码
<td>
<div class="c">
<span id="disp_registerName" class="cp edit_hide" style="display: none;"></span>
<input id="registerName" class="pa_ui_text edit_show pa_ui_element_normal" type="text" otitle="车主姓名" value="" name="register.name" style="display: inline;">
</div>
</td>
解决方法:
先从最里面的元素开始一级一级往上找,找到iframe,然后先select frame这个ID就可以定位到里面的元素了。
2,InvalidElementStateException: Message: u'Element must not be hidden, disabled or read-only'
针对根据复选框的状态,解决文本框中默认带出内容时。如果这样写就会报错
select checkbox id=noLicenseFlag
input text id=registerName 湘A*
像这样的组合,后面那句input text id=registerName 湘A*直接删除就可以了。
3,页面操作按钮提示找不到elements
click button id=carInfoSubmitBtn
改为click element id=carInfoSubmitBtn
4,根据录入框内容弹出框框,定位不到元素
采用相对路径的方式定位,用firefox浏览器打开地址,按F12获取元素位置,右击---选择复制XPATH
放在脚本中形式为:xpath=/html/body/div[9]/div[2]/table/tbody/tr[4]/td[4]
6,InvalidElementStateException: Message: u'Element must not be hidden, disabled or read-only'
出现这个现象是因为脚本执行快,而页面的元素还没有加载完成造成的。
等待页面加载
wait until page contains element或sleep
7,页面执行时没有报错,但一直停在那里了
利用Mouse out 关键字,移开鼠标动作。
8,使用close broswer关闭浏览器不起作用
首先安装pywin32-217.win32-py2.7.exe,再安装AutoItLibrary库,在close broswer关键字
下一行,增加删除进线的关键字: process close iexplore.exe
10,查看所有有关robot相关库的版本
pip list
11,通过pip升级库或程序版本
1,Python -m pip install --upgrade pip
报错:
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
2,根据提示,执行命令
python -m pip install --upgrade pip
报错:Requirement already up-to-date: pip in c:\python27\lib\site-packages
3,找到c:\python27\lib\site-packages下这个目录pip-8.1.1.dist-info并删除,重新执行
python -m pip install --upgrade pip
4,查看是否更新成功
pip list后显示最新版本
12,利用pip更新库或RIDE或robot
pip install robotframework-ride --upgrade
再用pip list可以看到升级成功的版本号了
13,Run Keyword And return status关键字识别不了
利用pip更新RIDE,robot,selenium2Library
14,ImportError:No module named cx_Oracle
根据连接oracle客户端的版本如:11G,操作系统是32位还是64位
安装对应的cx_Oracle安装包,如:cx_Oracle-5.1.2-11g.win32-py2.7
15,Unable to acquire Oracle environment handle
在oracle客户端的目录中把oci.dll,oraocci11.dll,oraociei11.dll文件复制到C:\Python27\Lib\site-packages目录中
16,日志目录
Log: d:\users\liujun~1\appdata\local\temp\RIDEwzyfth.d\log.html
Report: d:\users\liujun~1\appdata\local\temp\RIDEwzyfth.d\report.html
17,在IE中如果click不起作用,用如下关键字
press key id=kw \\13
18,单选框实例
<p class="checkBox">
<input id="registerGenderMale" class="pa_ui_element_normal" type="radio" value="M" name="register.gender" otitle="车主-性别男">
<label class="radiotxt" hidefocus="hidefoces" for="registerGenderMale">男</label>
<input id="registerGenderFemale" class="pa_ui_element_normal" type="radio" value="F" name="register.gender" otitle="车主-性别女">
<label class="radiotxt" hidefocus="hidefoces" for="registerGenderFemale">女</label>
</p>
select radio button register.gender M
19,下拉列表实例
<div class="pa_ui_dropselect_inner paui-clearfix">
<span class="pa_ui_dropselect_input_Container" style="width: 71px;">
<input class="pa_ui_dropselect_input" type="text" readonly="readonly" otitle="V3版-送单地址-县级市" style="width: 71px; opacity: 1;">
</span>
<span class="pa_ui_dropselect_button" otitle="V3版-送单地址-县级市">
</div>
select from list class="pa_ui_dropselect_inner paui-clearfix" 江北区
20,通过PIP安装Selenium2Library报错
C:\Users\Administrator>pip install Selenium2Library
Collecting Selenium2Library
Could not find a version that satisfies the requir
versions: )
No matching distribution found for Selenium2Library
解决办法:
pip install robotframework-Selenium2Library
就可以了
21,安装IEDriver报错
WebDriverException: Message: 'IEDriverServer.exe' executable needs to be in PATH. Please download fromhttp://selenium-release.storage.googleapis.com/index.html and read up athttps://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
解决办法:
下载对应系统版本的IEDriverServer.exe放在IE的安装目录下和Python的根目录下,并设置PATH。
22,滚动鼠标拖动滚动条到最顶部或最底部
execute JavaScript id.scrollTop其中id为滚动条区域对应的id,用法:
如:execute javascript J_introCon.scrollTop=0是拖到最顶部,execute javascript J_introCon.scrollTop=100000是拖到最底部
23,在CASE中的setup中可以设置运行CASE前,运行SETUP里面的关键字。teardown中可以设置运行CASE后,指定要运行的关键字
24,满足条件结束脚本
exit for loop
如:如果count值为0,则结束CASE
run keyword if ${count}==0 exit for loop
25,执行SQL时报错:DatabaseError:ORA-00911:Invalid character
去掉SQL后面的 ;
26,执行SQL查询
Execute sql String select * from 表名
RFS自动化测试工具安装与使用总结的更多相关文章
- nightwatch-前端自动化测试工具安装
最近再弄这个前端自动化测试工具,刚开始弄了几天,目前为止遇到很多坑,光是安装就费了不少时间,记录一下,以便自己忘记. 这里是它的官网,目前没找到中文版的官网,全英文,对我这个英语渣来说有点难理解. 一 ...
- PJSIP 自动化测试工具安装 Python安装
Python安装,记录步骤如下 1.下载PythonIDE安装包 到官网 https://repo.continuum.io/archive/下载需要的版本,选择的Anaconda版本3的,当然也可以 ...
- TOSCA自动化测试工具安装
1.下载链接 https://www.tricentis.com/software-testing-tools/ 2.免费试用14天, 弹出的页面输入邮箱地址--> 输入一堆信息-->点击 ...
- Android 手机自动化测试工具有哪几种?
1.Monkey是Android SDK自带的测试工具,在测试过程中会向系统发送伪随机的用户事件流,如按键输入.触摸屏输入.手势输入等),实现对正在开发的应用程序进行压力测试,也有日志输出.实际上该工 ...
- 前端自动化测试工具doh学习总结(二)
一.robot简介 robot是dojo框架中用来进行前端自动化测试的工具,doh主要目的在于单元测试,而robot可以用来模仿用户操作来测试UI.总所周知,Selenium也是一款比较流行的前端自动 ...
- 自动化测试工具QTP和SilkTest横向PK(转)
转自:http://www.uml.org.cn/Test/201405212.asp?artid=1686 众所周知,自动化测试工具曾几何时三足鼎立,Mercury QTP/WinRunner系.I ...
- Jmeter自动化测试工具的简单使用--HTTP测试
Jmeter自动化测试工具的简单应用 1.安装Jmeter 链接: https://pan.baidu.com/s/1mhSzU68 密码: 446z 到这里下载 1.1 jmeter 将下载好的 ...
- 开源Web自动化测试工具Selenium IDE
Selenium IDE(也有简写SIDE的)是一款开源的Web自动化测试工具,它实现了测试用例的录制与回放. Selenium IDE目前版本为 3.6 系列,支持跨浏览器运行,所以IDE的UI从原 ...
- 自动化测试工具Katalon简单使用
前一段时间接触了下Katalon,当时只是简单用了下,今天看到Katalon给发邮件,发现都忘记了,因此重新学习并记录下来 Katalon是在Selemium相同的内核上构建起来的一个自动化测试工具 ...
随机推荐
- 探索Redis设计与实现6:Redis内部数据结构详解——skiplist
本文转自互联网 本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial ...
- VMware Hyper-V不兼容
VMware Workstation Windows系統的Hyper-V不相容 禁用Device Guard或Credential Guard 1. 以管理員身份運行Windows Powershel ...
- Kali 和 Centos、Windows三系统的安装事项!
过年了,想在硬盘上直接装Kali Linux,就不用每次插U盘进LiveCD了,但是安装过程真的是!!What fucking word I can say!! 先是分区问题,ntfs有四个分区,其中 ...
- Redis 单机模式,主从模式,哨兵模式(sentinel),集群模式(cluster),第三方模式优缺点分析
Redis 的几种常见使用方式包括: 单机模式 主从模式 哨兵模式(sentinel) 集群模式(cluster) 第三方模式 单机模式 Redis 单副本,采用单个 Redis 节点部署架构,没有备 ...
- Tomcat 配置安装
1 下载和安装Tomcat服务器 Tomcat官方站点:http://jakarta.apache.org 下载Tomcat安装程序包:http://tomcat.apache.org/ 启动和测试T ...
- PAT甲级——1147 Heaps【30】
In computer science, a heap is a specialized tree-based data structure that satisfies the heap prope ...
- Java面试必问-ThreadLocal
前言 在面试环节中,考察"ThreadLocal"也是面试官的家常便饭,所以对它理解透彻,是非常有必要的. 有些面试官会开门见山的提问: “知道ThreadLocal吗?” “讲讲 ...
- SQL语句的执行顺序和效率
今天上午在开发的过程中,突然遇到一个问题,需要了解SQL语句的执行顺序才能继续,上网上查了一下相关的资料,现整理如下:一.sql语句的执行步骤: 1)语法分析,分析语句的语法是否符合规范,衡量语句中各 ...
- docker--环境搭建
我的电脑是win10,虽然现在win10开始也支持docker,但在linux机器会合适些,所以我先用VMware创建一个linux虚拟机--Centos7 安装虚拟机不多说,现在开始安装docker ...
- docker部署一个简单的mian.py项目文件
安装docker yum install -y docker 启动docker systemctl start docker 查询可安装的Python版本,默认centos python 2.7 ...