• RobotFrameWork 自动化环境搭建(基于 python3.6)


    一、需要安装的工具目录

    • 安装 python3.6.0
      • 我这里采用的是 python3.6 (目前慢慢市场在推广 python3.0 版本了)
    • 安装 robotframework==3.1.2
      • 注意:安装 robotframework 时指定安装 3.1.2 版本,否则易出现关键字缺失的问题
      • pip install robotframework==3.1.2  -i  https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
    • 安装 robotframework-ride 
      • pip install robotframework-ride  -i  https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
    • 安装 wxPython(Python 非常有名的一个GUI 库,支撑Ride的运行库)
      • 注意:安装 robotframework-ride 后,wxPython 可以不需要再去安装
      • pip install -U wxPython -i  https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
    • 安装 robotframework-selenium2library
      • pip install robotframework-selenium2library  -i  https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn  
    • 安装 RequestsLibrary
      • pip install -U robotframework-requests  -i  https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 
      • 在套件中导入 RequestsLibrary 库 
      • 执行请求报错:ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED
        • 解决办法:在 dos 窗口通过 pip list 查看 requests 库的版本,如果不是 2.21.0 则通过 pip uninstall requests 卸载
        • 卸载后重新安装 2.21.0 版本:pip install requests==2.21.0
    • 安装 databaselibrary
      • pip install robotframework-databaselibrary  -i  https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn  
    • 查看已安装的包
      • pip list
    • 启动 Ride 可视化图形工具

     

    二、安装步骤如下

    1、安装 python3.6,配置环境变量(这个在之前博客中已有步骤,这里就不赘述了)

    2、安装 wxPython

    • 方法一:通过下载 exe 文件安装(最简单的方式,但是 python3.0 很难找到对应的 wxPython.exe 文件)
      • 下载注意,需要下载与电脑和 python 解释器版本匹配的 exe 文件
      • 下载完成后双击安装即可,会自动识别你安装Python的目录,不需要你另外选择安装路径
      • 地址:https://sourceforge.net/projects/wxpython/files/

    • 方法二:通过 whl 文件安装
      • 去官网下载后缀为 whl 的文件,需要下载与自己电脑系统和 Python 版本相应的 whl 文件
      • 下载网址:https://pypi.org/project/wxPython/#files
      • 将 whl 文件放在 Python 安装目录下的 scripts 文件夹下
      • 在 CMD 命令窗口进入 scripts 目录下,输入:pip install XX-XXX-XXX.whl  -i  https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn(XX-XXX-XXX.whl 是你下载的 whl 文件名)
      • 稍等片刻即可安装完毕

    • 方法三:直接通过命令安装(推荐使用
      • 如下直接通过命令 pip install -U wxPython  -i  https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 完成

    3、安装 robotframework

    4、安装 robotframework-ride

    5、安装 robotframework-selenium2library

    三、pip 安装报错

    1、常出现 "connection to pypi.org time out"  问题

    • 原因:是因为没有指定镜像源,需要在后面加上 -i 参数,然后指定镜像源,并且要添加信任(--trusted-host 源地址)
    • 国内常用的镜像源
      • 阿里云:http://mirrors.aliyun.com/pypi/simple/
      • 豆瓣: http://pypi.douban.com/simple/
      • 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
      • 中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple/
    • 解决如下:pip install pymysql -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

    作者:多测师高级讲师_郑sir
    微信:ZhengYing8887
    出处:https://www.cnblogs.com/ZhengYing0813/
    备注:本文版权归作者所有,欢迎转载和添加作者微信探讨技术,但未经作者同意必须在文章页面给出原文链接,否则保留追究法律责任的权利。
  • 相关阅读:
    绑定对象
    类与对象
    视音频技术干货专栏
    sqlite3把字段为int32(用c++的time(nullptr)获取的)的秒数显示为年月日时分秒
    微信小程序开发 --- 小白之路 --- 心得
    spring cloud --- config 配置中心 [本地、git获取配置文件]
    spring cloud --- Zuul --- 心得
    spring boot --- 注解 @Bean 和@Component
    spring cloud --- Feign --- 心得
    spring cloud --- Ribbon 客户端负载均衡 + RestTemplate + Hystrix 熔断器 [服务保护] ---心得
  • 原文地址:https://www.cnblogs.com/ZhengYing0813/p/12461377.html
Copyright © 2020-2023  润新知