基于Python在MacOS上安装robotframework-ride

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
==> Caveats
This 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 are
defaulting 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
==> Caveats
This 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_profile
For compilers to find this software you may need to set:
  LDFLAGS: -L/usr/local/opt/sqlite/lib
  CPPFLAGS: -I/usr/local/opt/sqlite/include
For 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/python@2-2.7.15_1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python@2-2.7.15_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
==> Caveats
Pip and setuptools have been installed. To update them
 pip install --upgrade pip setuptools
You can install Python packages with
 pip install <package>
They will install into the site-package directory
 /usr/local/lib/python2.7/site-packages
See: 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.gz
curl: (6) Could not resolve host: akamai.bintray.com
Error: Failed to download resource "jpeg"
Download failed: https://homebrew.bintray.com/bottles/jpeg-9c.high_sierra.bottle.tar.gz
Warning: 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.gz
curl: (6) Could not resolve host: akamai.bintray.com
Error: Failed to download resource "libpng"
Download failed: https://homebrew.bintray.com/bottles/libpng-1.6.34.high_sierra.bottle.tar.gz
Warning: 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.gz
curl: (6) Could not resolve host: akamai.bintray.com
Error: Failed to download resource "libtiff"
Download failed: https://homebrew.bintray.com/bottles/libtiff-4.0.9_3.high_sierra.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz
curl: (28) Resolving timed out after 5551 milliseconds
Trying 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.patch
patching file libtiff/tif_dir.c
patching file tools/tiff2pdf.c
==> Applying patches/CVE-2017-18013.patch
patching file libtiff/tif_print.c
==> Applying patches/CVE-2018-5784.patch
patching file contrib/addtiffo/tif_overview.c
patching file tools/tiff2pdf.c
patching file tools/tiffcrop.c
==> Applying patches/CVE-2017-11613_part1.patch
patching file libtiff/tif_dirread.c
==> Applying patches/CVE-2017-11613_part2.patch
patching file libtiff/tif_dirread.c
==> Applying patches/CVE-2018-7456.patch
patching file libtiff/tif_dirread.c
patching file libtiff/tif_print.c
==> Applying patches/CVE-2017-17095.patch
patching 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.9MB
liumiaocn:~ liumiao$ 

版本确认

liumiaocn:~ liumiao$ brew info wxpython
wxpython: stable 3.0.2.0 (bottled)
Python bindings for wxWidgets
https://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:25
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wxpython.rb
==> Dependencies
Required: python@2 ✔, wxmac ✔
liumiaocn:~ liumiao$

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

创建链接

liumiaocn:bin liumiao$ pwd
/usr/local/bin
liumiaocn:bin liumiao$ ls wx
ls: wx: No such file or directory
liumiaocn:bin liumiao$ ln -s ../Cellar/wxpython/3.0.2.0_1/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx wx
liumiaocn: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.py
Wrong 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__.py
liumiaocn:local liumiao$ grep supported_versions ./lib/python2.7/site-packages/robotide/__init__.py
supported_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.org
37,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.org
44d43
<     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 robotframework
Collecting 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/fd9aef57cca0087d0bd5ceba5db39247ef375fdc4df5ebfb59
Successfully built robotframework
Installing collected packages: robotframework
Successfully installed robotframework-3.0.4
liumiaocn:~ liumiao$

启动RIDE

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

安装pygments

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

使用pip install pygments进行安装

liumiaocn:~ liumiao$ pip install pygments
Collecting 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: pygments
Successfully installed pygments-2.2.0
liumiaocn:~ liumiao$

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

总结

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

(0)

相关推荐

  • python selenium 查找隐藏元素 自动播放视频功能

    在使用python做爬虫的过程中,有些页面的的部分数据是通过js异步加载的,js调用接口的请求中有时还带有些加密的参数很难破解无法使用requests这样的包直接爬取数据,因此需要借助seleniu来完成js的自动加载. 通过selenium 模拟浏览器的真是操作来获取页面中的所有请求,并且可以查找到一下页面上一些隐藏的元素,这些元素在html源码中无法看到,并且和能通过xpath和正则来捕获,因此需要使用selenium来查找隐藏元素,例如视频网站的播放按钮 代码如下 import time

  • 基于python全局设置id 自动化测试元素定位过程解析

    背景: 在自动化化测试过程中,不方便准确获取页面的元素,或者在重构过程中方法修改造成元素层级改变,因此通过设置id准备定位. 一.python准备工作: 功能:用自动化的方式进行批量处理. 比如,你想要在大量的文本文件中执行查找/替换,或者以复杂的方式对大量的图片进行重命名和整理. 语法用例: #!/usr/bin/python //脚本语言的第一行,只对 Linux/Unix 用户适用,用来指定本脚本用什么解释器来执行,即:调用 /usr/bin 下的 python 解释器,推荐使用#!/us

  • python删除列表元素的三种方法(remove,pop,del)

    remove 删除单个元素,删除首个符合条件的元素,按值删除,返回值为空 List_remove = [1, 2, 2, 2, 3, 4] print(List_remove.remove(2)) print("after remove", List_remove) # None # after remove [1, 2, 2, 3, 4] -------------------------------------------------------------------------

  • selenium+python自动化测试之页面元素定位

    上一篇博客selenium+python自动化测试(二)–使用webdriver操作浏览器讲解了使用webdriver操作浏览器的各种方法,可以实现对浏览器进行操作了,接下来就是对浏览器页面中的元素进行操作,操作页面元素,首先要找到操作的元素,对元素进行定位 查看页面源码 要定位页面元素,需要找到页面的源码,IE浏览器中,打开页面后,在页面上点击鼠标右键,会有"查看源代码"的选项,点击后就会进入页面源码页面,在这里就可以找到页面的所有元素 使用Chrome浏览器打开页面后,在浏览器的地

  • python如何获取列表中每个元素的下标位置

    Git是编程中的基本技能之一,互联网公司几乎都在使用Git进行协作编程,昨天还有位禅友在微信上专门告诉我说星期五面试的时候刚好被问到 Git,幸好在这几天学了一下.Git并不难,但会Git至少可以说明一个人的学习能力或者说对技术的嗅觉能跟上主流,如果面试问你GitHub是什么都不知道,面试官就会对你打一个大的问号. 简单点评这一道题. 在使用 for 循环迭代一个列表时,有时我们需要获取列表中每个元素所在的下标位置是多少,例如 numbers = [10, 29, 30, 41],要求输出 (0

  • Python minidom模块用法示例【DOM写入和解析XML】

    本文实例讲述了Python minidom模块用法.分享给大家供大家参考,具体如下: 一.DOM写XML文件 # -*- coding:utf-8 -*- #!python3 #导入minidom from xml.dom import minidom # 1.创建DOM树对象 dom=minidom.Document() # 2.创建根节点.每次都要用DOM对象来创建任何节点. root_node=dom.createElement('root') # 3.用DOM对象添加根节点 dom.ap

  • python向字符串中添加元素的实例方法

    Python中的字符串对象是不能更改的,也即直接修改字符串中的某一位或几位字符是实现不了的,即python中字符串对象不可更改,但字符串对象的引用可更改,可重新指向新的字符串对象. + 直接字符串外+元素 name = 'zheng' print('my name is '+name) % 直接字符串外%(元素) 一种字符串格式化的语法, 基本用法是将值插入到%s占位符的字符串中. %s,表示格式化一个对象为字符 name = 'zhang' age = '25' print('my name

  • 基于Python在MacOS上安装robotframework-ride

    Robotframework是一个框架,是一个可以用于关键字测试驱动的框架.而RIDE(robotframework-ride)就是可以使得写robot测试用例更加方便快捷的IDE图形操作工具. 安装 因为是基于python的,所以其可以运行在多个操作系统上.这里主要介绍一下RIDE在MacOS上的使用方式. OS版本 MacOS版本:10.13.2 wxpython 由于RIDE是基于wxpython的应用,所以首先需要保证wxpython已经得到了安装.安装命令如下: 安装命令:brew i

  • 基于python指定包的安装路径方法

    通常python安装包都会被默认装在/usr/local/pythonx/lib/site-packages(linux),但是我们有时想自定义包的安装路径,比如自己项目的某个路径,这样在部署的时候就不用再安装了,大家都知道,java就是这么做的,java项目都是把依赖的lib放到一个目录,不然编译都没法通过,那么在python,我们能不能这样做呢,答案是可以的. 在easy_install的官方文档中,介绍了三种方法来自定义包的安装路径,分别如下: 1.使用--user参数 使用--user参

  • python 3.10上如何安装pyqt5

    目录 python 3.10上安装pyqt5 前言 第一步,安装嘛 1.安装PyQt5 2.安装Qt的工具包 第二步,配置环境变量 第三步,在pycharm里进行配置 python 3.10上安装pyqt5 前言 首先,看一下自己电脑上的python的版本,网上有太多乱七八糟的教程,啥也不说就硬教,跟着做的话就会出现稀里糊涂的报错,很耽误时间.我就是因为网上的教程痛苦了一天 回到正题,首先,就目前而言,想要在python 3.10上安装 PyQt5 的还是别努力了.pyqt5能在python3.

  • 在Linux上安装Python的Flask框架和创建第一个app实例的教程

    无论你在linux上娱乐还是工作,这对你而言都是一个使用python来编程的很好的机会.回到大学我希望他们教我的是Python而不是Java,这学起来很有趣且在实际的应用如yum包管理器中很有用. 本篇教程中我会带你使用python和一个称为flask的微型框架来构建一个简单的应用,来显示诸如每个进程的内存使用,CPU百分比之类有用的信息. 前置需求 Python基础.列表.类.函数.模块.HTML/CSS (基础). 学习这篇教程你不必是一个python高级开发者,但是首先我建议你阅读http

  • windows上安装Anaconda和python的教程详解

    一提到数字图像处理编程,可能大多数人就会想到matlab,但matlab也有自身的缺点: 1.不开源,价格贵 2.软件容量大.一般3G以上,高版本甚至达5G以上. 3.只能做研究,不易转化成软件. 因此,我们这里使用Python这个脚本语言来进行数字图像处理. 要使用Python,必须先安装python,一般是2.7版本以上,不管是在windows系统,还是Linux系统,安装都是非常简单的. 要使用python进行各种开发和科学计算,还需要安装对应的包.这和matlab非常相似,只是matla

  • 在macOS上搭建python环境的实现方法

    今天刚接触python,查看了一些环境建立的文章,可能是年代久远很多都不适用,现在mac搭建python环境变得更简单.大神勿喷. 首先去python官网下载anaconda,我下载的是Python3.6,64位的. 下载后直接安装. 安装完成后 将anaconda的bin目录加入PATH echo 'export PATH="/Users/work/anaconda/bin/:$PATH"' >> ~/.bashrc 更新bashrc以立即生效 source ~/.bas

  • 基于python实现FTP文件上传与下载操作(ftp&sftp协议)

    前言 FTP(File Transfer Protocol)是文件传输协议的简称.用于Internet上的控制文件的双向传输.同时,它也是一个应用程序(Application).用户可以通过它把自己的PC机与世界各地所有运行FTP协议的服务器相连,访问服务器上的大量程序和信息.如果用户需要将文件从自己的计算机上发送到另一台计算机上,可使用FTP上传(upload)或(put)操作,而更多种的情况是用户使用FTP下载(download)或获取(get)操作从FTP服务器上下载文件 在传输文件时我们

  • 在树莓派2或树莓派B+上安装Python和OpenCV的教程

    我的Raspberry Pi 2昨天刚邮到,这家伙看上去很小巧可爱. 这小家伙有4核900MHZ的处理器,1G内存.要知道,Raspberry Pi 2 可比我中学电脑实验室里大多数电脑快多了. 话说,自从Raspberry Pi 2发布以来,我收到了很多请求,要求我能写一个在它上面安装OpenCV和Python的详细说明. 因此如果你想在Raspberry Pi启动运行OpenCV和Python,就往下面看! 在博文的剩余部分,我将提供在Raspberry Pi 2 和Raspberry Pi

  • 基于python中pygame模块的Linux下安装过程(详解)

    一.使用pip安装Python包 大多数较新的Python版本都自带pip,因此首先可检查系统是否已经安装了pip.在Python3中,pip有时被称为pip3. 1.在Linux和OS X系统中检查是否安装了pip 打开一个终端窗口,并执行如下命令: Python2.7中: zhuzhu@zhuzhu-K53SJ:~$ pip --version pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7) Python3.X中: z

  • 基于Python安装pyecharts所遇的问题及解决方法

    最近学习到数据可视化内容,老师推荐安装pyecharts,于是pip install 了一下,结果...掉坑了,下面是我的跳坑经验,如果你有类似问题,希望对你有所帮助. 第一个坑: 这个不难理解,缺少pyecharts-jupyter-installer嘛,那就安一个呗.可能有人注意到,我使用的是python2 -m pip ...(这种写法是为了解决python 2和3共存时pip的冲突问题,具体解释在本页最后.) 本以为结束了,却掉进了第二个坑: 看到这个,很明显是安装MarkupSafe时

随机推荐