本教程适用于python3.X+RobotFramework
很多人学习robotframework,搭建环境的时候就遇到各种各样的问题,所以早早打消了学习的念头,其实不然,robotframework环境还是比较好搭建的。
一、安装python
首先查看本机是否已经安装python: (命令为 python3),如果没有安装请安装python
二、安装相关库
安装过程中如果下载很缓慢,可以修改镜像源
1)可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,这样就会从清华这边的镜像去安装pyspider库。
2)一劳永逸方法:
windows下,直接在user目录中创建一个pip目录,再新建文件pip.ini
内容为:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
robotframework常用的库:
pip3 install robotframework
pip3 install robotframework-seleniumlibrary
pip3 install robotframework-databaselibrary
pip3 install cx_Oracle
pip3 install pymysql
pip3 install robotframework-faker
pip3 install selenium
pip3 install robotframework-SikuliLibrary
pip3 install xlwt
pip3 install xlrd
pip3 install pyyaml
pip3 install openpyxl
三、安装IDE(集成开发环境)
1、使用RIDE
需要安装:
pip3 install robotframework-ride
pip3 insatll wxPython
四、下载浏览器驱动
IE驱动下载地址:
http://selenium-release.storage.googleapis.com/index.html
谷歌驱动下载地址:http://chromedriver.storage.googleapis.com/index.html
• 谷歌驱动版本:根据自己谷歌浏览器版本安装对应chromedriver的版本
• IE驱动版本:IEDriverServer的版本号和Selenium的版本号一定要一致