一、安装步骤
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
![img_beb28be9519e5eb00c969a400dc6d4cb.png](https://i-blog.csdnimg.cn/blog_migrate/1c2a637d30697f6ad7ec703989a11ac5.png)
10、在pycharm中配置RF的文件类型识别
还是打开设置面板,如图所示来配置一下(因为RF的文件,我们在ide中设置的是txt格式,所以我们添加*.txt,如果你设置的是其他格式,那就添加其他格式就好了)
![img_3a7a13fba872aba1ac3b1c2be326159a.png](https://i-blog.csdnimg.cn/blog_migrate/842df020eec3b2fd626a14ac218e92f1.png)
11、在pycharm中配置suite和case的运行配置
①配置suite
Robot Run TestSuite
-d results $FileName$
$FileDir$
![img_07dfbec964a2805d724a27c87731475e.png](https://i-blog.csdnimg.cn/blog_migrate/846132762a82c65a51bdbe167a06225d.png)
②设置case
Robot Run SingleTestCase
-d results -t "$SelectedText$" ./
$FileDir$
![img_ab07c73c390f5d59cc2c2d6045262134.png](https://i-blog.csdnimg.cn/blog_migrate/f94b272913c5898571f64ae922e40c8f.png)
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、运行结果
![img_75c2c90da2aaedfd975088341b59b794.png](https://i-blog.csdnimg.cn/blog_migrate/eec4b8b13bd09f0f9ba74cf72a0d033c.png)
这样,我们就成功通过pycharm运行了RF脚本!RF持续更新中。。。