robotframework+selenium环境搭建
1 安装python2.7
https://www.python.org/
2 安装wxPython,主要是为了robotframework-ride的图形界面
http://www.wxpython.org/download.phpwxPython3.0-win32-py27 32-bit Python 2.7
3 安装robotframework-2.8.4
https://pypi.python.org/pypi/robotframework/2.8.4robotframework-2.8.4.tar.gz解压进入目录,python setup.py installor:pip install robotframework
4 安装selenium-2.44.0,为了安装robotframework-selenium2library
http://code.google.com/p/selenium/downloads/list解压进入目录: python setup.py installor:pip install selenium
5 安装 decorator-3.4.0,为了安装robotframework-selenium2library
https://pypi.python.org/pypi/decorator/解压进入目录:python setup.py installor:pip install decorator
6 安装docutils-0.11,为了安装robotframework-selenium2library
http://docutils.sourceforge.net/
7 安装 robotframework-selenium2library
https://pypi.python.org/pypi/robotframework-selenium2library/解压进入目录: python setup.py installor:pip install robotframework-selenium2library
8 安装 robotframework-ride
https://pypi.python.org/pypi/robotframework-ride 源码解压进入目录: python setup.py installor:pip install robotframework-ride
遇到的问题
python在windows当中的注册问题
有时在安装一些win32的程序时,需要python在windows中进行注册,此时需要新建注册表cmd -- regedit -- HKEY_LOCAL_MACHINE --SOFTWARE --Python --PythonCore --2.7 --InstallPath --C:\Python27\ --PythonPath --C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk
#python_register_in_windows.pyimport sysfrom _winreg import *# tweak as necessaryversion = sys.version[:3] #2.7installpath = sys.prefix #c:\Python27regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)installkey = "InstallPath"pythonkey = "PythonPath"pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % ( installpath, installpath, installpath)def RegisterPy(): reg = CreateKey(HKEY_LOCAL_MACHINE, regpath) SetValue(reg, installkey, REG_SZ, installpath) #设置InstallPath is C:\Python27 SetValue(reg, pythonkey, REG_SZ, pythonpath) #设置PythonPath is C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk CloseKey(reg)if __name__ == "__main__": RegisterPy()
wxPython安装不上的问题
C:\Python27\Scripts>python ride.pywxPython not found.You need to install wxPython 2.8 toolkit 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/在64位机,安装64bit的wxPython安装成功,但导入库时出错,因此目前只能装32bit的wxPython,即使在64bit操作系统中,也安装32位的wxpython
selenium启动后停留在首页不会跳转到所需要的页面上
selenium2.44以前的版本可能存在这个问题,由其是在firefox上,是一个已知的bug,只需要更新到新的版本即可pip install -U selenium
robotframework在线安装就要简单很多
install wxPython2.8-win32-unicodepip install robotframeworkpip install seleniumpip install robotframework-ridepip install robotframework-selenium2library