测试环境: windows
安装前提: 已安装python(robotframework基于python环境)
python安装过程略过
安装的软件参考的这篇博文robot framework自动化测试参考手册
- 安装python库
# 安装robotframework,主要框架
pip install robotframework
# 安装wxPython,GUI库,RIDE依赖
pip install wxPython
# 安装Robot framework-ride,图形化界面
pip install robotframework-ride
# 其他可能用到的库
# 建议安装
pip install robotframework-selenium2library
pip install requests
pip install robotframework-requests
pip install robotframework-httplibrary
# 可选安装
pip install robotframework-archivelibrary
pip install robotframework-SSHLibrary
pip install robotframework-ftplibrary
- 下载chrom驱动下载地址
下载后将文件路径配置到环境变量PATH中 - 启动robotframework-ride
# 在python 的Script 路径下运行(pip show robotframework-ride查看路径,找到script文件夹下的ride)
python ride.py
# 启动出现错误
Creating librarykeywords database to "C:\Users\Administrator\AppData\Roaming\RobotFramework\ride\librarykeywords.db"
Traceback (most recent call last):
File "D:\dongwei\software\work\anaconda3\lib\site-packages\robotide\application\application.py", line 58, in OnInit
self.frame = RideFrame(self, self._controller)
File "D:\dongwei\software\work\anaconda3\lib\site-packages\robotide\ui\mainframe.py", line 175, in __init__
self._init_ui()
File "D:\dongwei\software\work\anaconda3\lib\site-packages\robotide\ui\mainframe.py", line 279, in _init_ui
self.tree = Tree(self, self.actions,
File "D:\dongwei\software\work\anaconda3\lib\site-packages\robotide\ui\tree.py", line 86, in __init__
self._images = TreeImageList()
File "D:\dongwei\software\work\anaconda3\lib\site-packages\robotide\ui\images.py", line 42, in __init__
TestCaseController: _TreeImage(self, 'robot.png'),
File "D:\dongwei\software\work\anaconda3\lib\site-packages\robotide\ui\images.py", line 80, in __init__
self.normal = self._get_image(image_list, normal)
File "D:\dongwei\software\work\anaconda3\lib\site-packages\robotide\ui\images.py", line 91, in _get_image
img = wx.Image(path, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL), "C") == 0" failed at ..\..\src\common\intl.cpp(1579) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a mismatch between C/C++ and Windows locale.
Things are going to break, please only change locale by creating wxLocale objects to avoid this!
OnInit returned false, exiting...
Error in atexit._run_exitfuncs:
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at ..\..\src\common\wincmn.cpp(478) in wxWindowBase::~wxWindowBase(): any pushed event handlers must have been removed
# 根据第一错误找到application.py文件
File "D:\dongwei\software\work\anaconda3\lib\site-packages\robotide\application\application.py", line 58, in OnInit
self.frame = RideFrame(self, self._controller)
在文件第50行 将 self._initial_locale = wx.Locale(wx.LANGUAGE_ENGLISH) 改为
self.locale = wx.Locale(wx.LANGUAGE_CHINESE_SIMPLIFIED)
报存后重新运行启动命令
- 启动成功