侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

基于Python在MacOS上安装robotframework-ride

Python  /  管理员 发布于 7年前   191

Robotframework是一个框架,是一个可以用于关键字测试驱动的框架。而RIDE(robotframework-ride)就是可以使得写robot测试用例更加方便快捷的IDE图形操作工具。

安装

因为是基于python的,所以其可以运行在多个操作系统上。这里主要介绍一下RIDE在MacOS上的使用方式。

OS版本

MacOS版本:10.13.2

wxpython

由于RIDE是基于wxpython的应用,所以首先需要保证wxpython已经得到了安装。安装命令如下:

安装命令:brew install wxpython

安装日志

liumiaocn:~ liumiao$ brew install wxpython==> Installing dependencies for wxpython: gdbm, readline, sqlite, python@2, jpeg, libpng, libtiff, wxmac==> Installing wxpython dependency: gdbm==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.15.high_sierra.bottle.tar.gz######################################################################## 100.0%==> Pouring gdbm-1.15.high_sierra.bottle.tar.gz? /usr/local/Cellar/gdbm/1.15: 19 files, 569.8KB==> Installing wxpython dependency: readline==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.3_1.high_sierra.bottle.tar.gz######################################################################## 100.0%==> Pouring readline-7.0.3_1.high_sierra.bottle.tar.gz==> CaveatsThis formula is keg-only, which means it was not symlinked into /usr/local,because macOS provides the BSD libedit library, which shadows libreadline.In order to prevent conflicts when programs look for libreadline we aredefaulting this GNU Readline installation to keg-only.For compilers to find this software you may need to set:  LDFLAGS: -L/usr/local/opt/readline/lib  CPPFLAGS: -I/usr/local/opt/readline/include==> Summary? /usr/local/Cellar/readline/7.0.3_1: 46 files, 1.5MB==> Installing wxpython dependency: sqlite==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.24.0.high_sierra.bottle.tar.gz######################################################################## 100.0%==> Pouring sqlite-3.24.0.high_sierra.bottle.tar.gz==> CaveatsThis formula is keg-only, which means it was not symlinked into /usr/local,because macOS provides an older sqlite3.If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profileFor compilers to find this software you may need to set:  LDFLAGS: -L/usr/local/opt/sqlite/lib  CPPFLAGS: -I/usr/local/opt/sqlite/includeFor pkg-config to find this software you may need to set:  PKG_CONFIG_PATH: /usr/local/opt/sqlite/lib/pkgconfig==> Summary? /usr/local/Cellar/sqlite/3.24.0: 11 files, 3.5MB==> Installing wxpython dependency: python@2==> Downloading https://homebrew.bintray.com/bottles/[email protected]_1.high_sierra.bottle.tar.gz######################################################################## 100.0%==> Pouring [email protected]_1.high_sierra.bottle.tar.gz==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-mana==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-mana==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-mana==> CaveatsPip and setuptools have been installed. To update them pip install --upgrade pip setuptoolsYou can install Python packages with pip install <package>They will install into the site-package directory /usr/local/lib/python2.7/site-packagesSee: https://docs.brew.sh/Homebrew-and-Python==> Summary? /usr/local/Cellar/python@2/2.7.15_1: 4,673 files, 82.8MB==> Installing wxpython dependency: jpeg==> Downloading https://homebrew.bintray.com/bottles/jpeg-9c.high_sierra.bottle.tar.gzcurl: (6) Could not resolve host: akamai.bintray.comError: Failed to download resource "jpeg"Download failed: https://homebrew.bintray.com/bottles/jpeg-9c.high_sierra.bottle.tar.gzWarning: Bottle installation failed: building from source.==> Downloading http://www.ijg.org/files/jpegsrc.v9c.tar.gz######################################################################## 100.0%==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/jpeg/9c==> make install? /usr/local/Cellar/jpeg/9c: 21 files, 749.8KB, built in 33 seconds==> Installing wxpython dependency: libpng==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.34.high_sierra.bottle.tar.gzcurl: (6) Could not resolve host: akamai.bintray.comError: Failed to download resource "libpng"Download failed: https://homebrew.bintray.com/bottles/libpng-1.6.34.high_sierra.bottle.tar.gzWarning: Bottle installation failed: building from source.==> Downloading https://downloads.sourceforge.net/libpng/libpng-1.6.34.tar.xz==> Downloading from https://downloads.sourceforge.net/project/libpng/libpng16/1.6.34/libpng-1.6.34.tar.xz######################################################################## 100.0%==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/libpng/1.6.34==> make==> make test==> make install? /usr/local/Cellar/libpng/1.6.34: 26 files, 1.2MB, built in 1 minute 38 seconds==> Installing wxpython dependency: libtiff==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.9_3.high_sierra.bottle.tar.gzcurl: (6) Could not resolve host: akamai.bintray.comError: Failed to download resource "libtiff"Download failed: https://homebrew.bintray.com/bottles/libtiff-4.0.9_3.high_sierra.bottle.tar.gzWarning: Bottle installation failed: building from source.==> Downloading https://download.osgeo.org/libtiff/tiff-4.0.9.tar.gzcurl: (28) Resolving timed out after 5551 millisecondsTrying a mirror...==> Downloading https://fossies.org/linux/misc/tiff-4.0.9.tar.gz######################### 34.8%######################################################################## 100.0%==> Downloading https://mirrors.ocf.berkeley.edu/debian/pool/main/t/tiff/tiff_4.0.9-5.debian.tar.xz######################################################################## 100.0%==> Patching==> Applying patches/CVE-2017-9935.patchpatching file libtiff/tif_dir.cpatching file tools/tiff2pdf.c==> Applying patches/CVE-2017-18013.patchpatching file libtiff/tif_print.c==> Applying patches/CVE-2018-5784.patchpatching file contrib/addtiffo/tif_overview.cpatching file tools/tiff2pdf.cpatching file tools/tiffcrop.c==> Applying patches/CVE-2017-11613_part1.patchpatching file libtiff/tif_dirread.c==> Applying patches/CVE-2017-11613_part2.patchpatching file libtiff/tif_dirread.c==> Applying patches/CVE-2018-7456.patchpatching file libtiff/tif_dirread.cpatching file libtiff/tif_print.c==> Applying patches/CVE-2017-17095.patchpatching file tools/pal2rgb.c==> ./configure --prefix=/usr/local/Cellar/libtiff/4.0.9_3 --without-x --with-jpeg-include-dir=/usr/local/opt/jpeg/include --with-jpeg-==> make install? /usr/local/Cellar/libtiff/4.0.9_3: 246 files, 3.5MB, built in 5 minutes 10 seconds==> Installing wxpython dependency: wxmac==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.4.high_sierra.bottle.tar.gz######################################################################## 100.0%==> Pouring wxmac-3.0.4.high_sierra.bottle.tar.gz? /usr/local/Cellar/wxmac/3.0.4: 810 files, 23.7MB==> Installing wxpython==> Downloading https://homebrew.bintray.com/bottles/wxpython-3.0.2.0_1.high_sierra.bottle.tar.gz######################################################################## 100.0%==> Pouring wxpython-3.0.2.0_1.high_sierra.bottle.tar.gz? /usr/local/Cellar/wxpython/3.0.2.0_1: 1,108 files, 37.9MBliumiaocn:~ liumiao$ 

版本确认

liumiaocn:~ liumiao$ brew info wxpythonwxpython: stable 3.0.2.0 (bottled)Python bindings for wxWidgetshttps://www.wxwidgets.org//usr/local/Cellar/wxpython/3.0.2.0_1 (1,115 files, 39.9MB) * Poured from bottle on 2018-06-19 at 15:52:25From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wxpython.rb==> DependenciesRequired: python@2 ✔, wxmac ✔liumiaocn:~ liumiao$

暂定对应1:wxpython安装之后,目前的版本还缺少一个软连接才能正常动作,根据日志可以看到此次安装的wxpython版本为wxpython-3.0.2.0_1, 按照如下操作创建软连接即可

创建链接

liumiaocn:bin liumiao$ pwd/usr/local/binliumiaocn:bin liumiao$ ls wxls: wx: No such file or directoryliumiaocn:bin liumiao$ ln -s ../Cellar/wxpython/3.0.2.0_1/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx wxliumiaocn:bin liumiao$

确认方式

liumiaocn:~ liumiao$ python -c "import wx; print wx.VERSION"/usr/local/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx/_core.py:16633: UserWarning: wxPython/wxWidgets release number mismatch warnings.warn("wxPython/wxWidgets release number mismatch")(3, 0, 2, 0, '')liumiaocn:~ liumiao$

虽然仍然提示warning信息,但是已经能够正常继续动作了。

安装robotframework-ride

使用pip安装robotframework-ride, 安装命令如下

安装命令:pip install robotframework-ride

启动确认

通过ride.py启动RIDE,当前版本出现了如下错误信息

liumiaocn:bin liumiao$ ride.pyWrong wxPython version.You need to install wxPython 2.8.12.1 with unicode support to run RIDE.wxPython 2.8.12.1 can be downloaded from http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/liumiaocn:bin liumiao$

原因确认:经过定位代码中错误出现的位置,确认到如下文件:

liumiaocn:local liumiao$ find . -name '*.py' |xargs grep 'You need to install wxPython'./lib/python2.7/site-packages/robotide/__init__.py:You need to install wxPython 2.8.12.1 with unicode support to run RIDE.liumiaocn:local liumiao$ view ./lib/python2.7/site-packages/robotide/__init__.pyliumiaocn:local liumiao$ grep supported_versions ./lib/python2.7/site-packages/robotide/__init__.pysupported_versions = ["2.8"]    supported_versions.append("2.9")  wxversion.select(supported_versions)liumiaocn:local liumiao$

对应方法1:直接将支持的版本号修改为当前的版本

liumiaocn:~ liumiao$ diff /usr/local/lib/python2.7/site-packages/robotide/__init__.py /usr/local/lib/python2.7/site-packages/robotide/__init__.py.org37,38c37< #supported_versions = ["2.8"]< supported_versions = ["3.0.2.0"]---> supported_versions = ["2.8"]liumiaocn:~ liumiao$

对应方法2:添加supported_versions

liumiaocn:~ liumiao$ diff /usr/local/lib/python2.7/site-packages/robotide/__init__.py /usr/local/lib/python2.7/site-packages/robotide/__init__.py.org44d43<     supported_versions.append("3.0.2.0")liumiaocn:~ liumiao$

实际上在如下行添加了对当前版本的支持

 try:   import wxversion   from wxversion import VersionError   if sys.platform == 'darwin':     supported_versions.append("2.9")     supported_versions.append("3.0.2.0")   wxversion.select(supported_versions)   import wx

安装robotframework

使用pip install robotramework进行robotframework的安装

liumiaocn:~ liumiao$ pip install robotframeworkCollecting robotframework Downloading https://files.pythonhosted.org/packages/95/b1/4faa12e1950b9fbd00060c112fa6f828c4f3998e9b2f8c570c22db10bc88/robotframework-3.0.4.tar.gz (443kB)  100% || 450kB 34kB/s Building wheels for collected packages: robotframework Running setup.py bdist_wheel for robotframework ... done Stored in directory: /Users/liumiao/Library/Caches/pip/wheels/8a/01/4a/fd9aef57cca0087d0bd5ceba5db39247ef375fdc4df5ebfb59Successfully built robotframeworkInstalling collected packages: robotframeworkSuccessfully installed robotframework-3.0.4liumiaocn:~ liumiao$

启动RIDE

在命令行输入ride.py并回车,便可启动RIDE

安装pygments

Text Edit的tab提示需要安装高亮显示用的包pygments

使用pip install pygments进行安装

liumiaocn:~ liumiao$ pip install pygmentsCollecting pygments Downloading https://files.pythonhosted.org/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl (841kB)  100% || 849kB 1.9MB/s Installing collected packages: pygmentsSuccessfully installed pygments-2.2.0liumiaocn:~ liumiao$

再次启动ride.py,已经可以正常动作了。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家的支持。如果你想了解更多相关内容请查看下面相关链接


  • 上一条:
    python获取服务器响应cookie的实例
    下一条:
    Python3爬虫之urllib携带cookie爬取网页的方法
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 在python语言中Flask框架的学习及简单功能示例(0个评论)
    • 在Python语言中实现GUI全屏倒计时代码示例(0个评论)
    • Python + zipfile库实现zip文件解压自动化脚本示例(0个评论)
    • python爬虫BeautifulSoup快速抓取网站图片(1个评论)
    • vscode 配置 python3开发环境的方法(0个评论)
    • 近期文章
    • 在windows10中升级go版本至1.24后LiteIDE的Ctrl+左击无法跳转问题解决方案(0个评论)
    • 智能合约Solidity学习CryptoZombie第四课:僵尸作战系统(0个评论)
    • 智能合约Solidity学习CryptoZombie第三课:组建僵尸军队(高级Solidity理论)(0个评论)
    • 智能合约Solidity学习CryptoZombie第二课:让你的僵尸猎食(0个评论)
    • 智能合约Solidity学习CryptoZombie第一课:生成一只你的僵尸(0个评论)
    • 在go中实现一个常用的先进先出的缓存淘汰算法示例代码(0个评论)
    • 在go+gin中使用"github.com/skip2/go-qrcode"实现url转二维码功能(0个评论)
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2016-10
    • 2016-11
    • 2018-04
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2022-01
    • 2023-07
    • 2023-10
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客