安装Selenium2Library步骤以及加载Selenium2Library时为红色

安装Selenium2Library:

下载地址:https://pypi.python.org/pypi/robotframework-selenium2library/1.5.0

可以通过下载exe 程序进行安装,Robot framework-selenium2library 分别提供了,win-amd64.exe和win32.exe 两个Windows 版本,你可以根据自己的环境下载相应的版本,双击进行安装。

如果像安装普通的Python 程序,可以下载tar.gz 文件,解压并运行setup.py 文件进行安装。

 cmd:

C: obotRobot framework-selenium2library-1.5.0>python setup.py install

 pip安装:

C:Python27Libsite-packages>pip install robotframework-selenium2library

添加库:

添加完成,黑色示添加的库正常,红色表示库不存。如果为红色,请检查
C:Python27Libsite-packages 目录下是否有Selenium2Library 目录

1. 加载Selenium2Library时为红色,在D:Python27Libsite-packages目录下有Selenium2Library文件夹扔报错:

加载Selenium2Library 所需要的库的文件,存放在D:Python27Libsite-packages:easy-install.pth文件中,需要的文件有:

import sys; sys.__plen = len(sys.path)

./pip-1.4.1-py2.7.egg

./robotframework_selenium2library-1.5.0-py2.7.egg

./docutils-0.11-py2.7.egg

./decorator-3.4.0-py2.7.egg

./selenium-2.40.0-py2.7.egg(当时是缺少这个文件)

import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

我将缺少的那个文件名添加之后就没有问题了

原文地址:https://www.cnblogs.com/Jindy-mine/p/6429853.html