一、安装步骤
1、首先安装python运行环境,我用的2.7版本,当然也有更高的版本,不过安装其他插件的过程中,出现版本问题,所以用了2.7。
2、安装pip(python包管理工具) https://pip.pypa.io/en/latest/index.html 进入下载get-pip.by文件,进入控制台执行easy_install pip安装pip,以下命令都是控制台执行
3、安装robot framework,执行pip install robotframework
4、安装robotframework-ride,执行pip install robotframework-ride
5、安装selenium2library,执行pip install robotframework-selenium2library
6、安装decorator-3.3.3.tar,执行pip install decorator
7、安装selenium,执行pip installselenium
8、安装PythonIDE pycharm
9、在pycharm中配置intelliBot
如图所示,我们通过File-settings来打开设置面板,然后按照图中步骤来下载这个插件,然后重启pycharm

10、在pycharm中配置RF的文件类型识别
还是打开设置面板,如图所示来配置一下(因为RF的文件,我们在ide中设置的是txt格式,所以我们添加*.txt,如果你设置的是其他格式,那就添加其他格式就好了)

11、在pycharm中配置suite和case的运行配置
①配置suite
Robot Run TestSuite
-d results $FileName$
$FileDir$

②设置case
Robot Run SingleTestCase
-d results -t "$SelectedText$" ./
$FileDir$

12、运行RF脚本
我们打开已经导入的脚本文件,通过右键调出编辑菜单,然后通过external来运行test_suite.txt
*** Settings ***
Library Selenium2Library
*** Test Cases ***
test01
[Documentation] 测试淘宝
Open Browser https://login.taobao.com/member/login.jhtml chrome
Click Element xpath=//*[@id="J_Quick2Static"]
Sleep 1
Input Text xpath=//*[@id="TPL_username_1"] 123
Input Text xpath=//*[@id="TPL_password_1"] 123
${title_1} Get Title
Click Button xpath=//*[@id="J_SubmitStatic"]
Sleep 2
${title_2} Get Title
should not contain ${title_2} ${title_1}
Close browser
13、运行结果

这样,我们就成功通过pycharm运行了RF脚本!RF持续更新中。。。
网友评论