AutoItLibrary 安装步骤:
1、 安装pythonwin32
在下载地址:http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/找到对应自己python的pythonwin32版本,下载并安装pythonwin32。
最新的版本为build220。
【注意】:不管电脑的版本是否为32或者64位的,pythonwin32的版本需要匹配python的版本。
Python的版本可以按照以下步骤查看:cmd->python
2、 安装AutoItLibrary
2.1下载
* 直接官网下载地址:
http://www.softpedia.com/get/Programming/Components-Libraries/AutoItLibrary.shtml
** Csdn下载地址:http://download.csdn.net/detail/liuheng123456/6236097
*** Google下载地址:https://code.google.com/p/robotframework-autoitlibrary/
2.2安装
将上面下载好的AutoItLibrary解压,然后以管理员身份【很重要!很重要!很重要!】打开cmd窗口,使得当前目录为AutoItLibrary的存放目录,然后通过cmd命令python setup.py install进行安装。一般安装正常的话,cmd窗口会输出下图所示的信息,就表示安装成功了。
【验证是否成功安装】
* 若已经成功安装了,则在C盘可以看到多了一个文件夹:RobotFramework,里面存放的就是RobotFramework的扩展库。
** 进入python shell环境,通过输入import AutoItLibrary,若没有报错则表示AutoItLibrary 成功安装。
*** 通过进入robotframework界面,通过导入AutoItLibrary库,看是否显示正常(黑色显示)。
****或者通过关键字搜索,看看是否可以显示AutoItLibrary库。
3、 安装AutoIt V3
由于AutoIt V3不支持64为机器,需要安装AutoIt V3。
下载地址:https://www.autoitscript.com/site/autoit/downloads/
4、常见错误处理
4.1 在安装过程中出现错误:
subprocess.CalledProcessError:Command‘%SYSTEMROOT%\system32\regsvr32.exe*\Lib\AutoItX3.dll’returned non-zero exit status 5
【解决方法】:
利用管理员身份运行cmd,然后cd到AutoItLibrary的目录下,再执行命令:python setup.py install。
如果仍然无法解决问题,可以找到setup.py 内subprocess.check_all(cmd,shell=True)和subprocess.CalledProcessError(retcode,cmd),并将其注释掉。再重新以管理员身份运行python setup.py install命令。
4.2 安装好了AutoItLibrary,但是导入到RIDE后,仍然红色显示,并在cmd窗口内输出如下错误信息:
Initializing test library ‘AutoItLibrary’with no arguments failed:com_error(-2147024703, 'OLE error 0x800700c1', None,None)
或者提示错误信息:
Creating an instance of the test library'AutoItLibrary' with no arguments failed: com_error: (-2147221164,'\xc3\xbb\xd3\xd0\xd7\xa2\xb2\xe1\xc0\xe0', None, None)
【解决方法】:
重新以管理员身份运行cmd,并切换到AutoItLibrary目录下安装。Cmd命令窗口输出以下信息:
再依据前文第2点,重新检查一遍是否已经正确安装。
参考文献:
RFS+AutoItLibrary: http://blog.csdn.net/tulituqi/article/details/21871247
AutoIt 使用: http://toolsqa.com/selenium-webdriver/autoit-selenium-webdriver/
RIDE导入AutoItLibrary: http://blog.csdn.net/wangjingna/article/details/49903697