我对机器人框架非常陌生
我使用的是运行在RIDE 1.5.2.1上的Python 2.7.13。在我的机器上安装了Python之后,我执行了以下操作,以安装Selenium2Library:
python -m pip install robotframework-selenium2library它似乎已经安装到了路径上:
C:\Python27\Lib\site-packages现在,我想在RIDE中将selenium2library添加到我的robotframework项目中,但是找不到文件。
下面是我的测试套件:
*** Settings ***
Library selenium2library
*** Test Cases ***
User can load the landing page
[Documentation] User opens the landing page
Open Browser http://localhost:8080/ ie
Close Browser但是这个错误失败了:
[ ERROR ] Error in file 'C:\Python27\Scripts\Customer\Landing_Page\Landing_Page.txt': Importing test library 'selenium2library' failed: ImportError: No module named selenium2library
Traceback (most recent call last):
Traceback (most recent call last):
None
PYTHONPATH:
C:\Windows\SYSTEM32\python27.zip
C:\Python27\DLLs
C:\Python27\lib
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages
C:\Python27\lib\site-packages\robotframework-3.0-py2.7.egg
C:\Python27\lib\site-packages\decorator-4.0.10-py2.7.egg
C:\Python27\lib\site-packages\robotframework_selenium2library-1.8.0-py2.7.egg
C:\Python27\lib\site-packages\selenium-3.0.2-py2.7.egg
C:\Python27\lib\site-packages\pygments-2.1.3-py2.7.egg
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
Customer | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed看来,它没有找到Selenium2library`,但是当我再次安装它时,它说:
Requirement already satisfied: robotframework-selenium2library in c:\pytho
b\site-packages
Requirement already satisfied: decorator>=3.3.2 in c:\python27\lib\site-pa
(from robotframework-selenium2library)
Requirement already satisfied: selenium>=2.32.0 in c:\python27\lib\site-pa
(from robotframework-selenium2library)
Requirement already satisfied: robotframework>=2.6.0 in c:\python27\lib\si
kages\robotframework-3.0-py2.7.egg (from robotframework-selenium2library)我很困惑,好像我已经有selenium2library了,但是骑马找不到吗?
发布于 2016-12-22 20:40:49
请按照本网站https://github.com/robotframework/RIDE/wiki/Installation-Instructions上的说明操作
一旦你和PIP - https://github.com/robotframework/robotframework/blob/master/INSTALL.rst#installing-with-pip一起安装了它
您可以使用'pip冻结‘命令检查已安装的库版本。
还请确保使用python已安装的文件夹和脚本文件夹更新PATH变量。
一旦您知道安装了所有必需的库,就可以导入selenium库。
*** Settings ***
Documentation A test suite with a single test for valid login.
Library Selenium2Library
...发布于 2016-12-23 01:26:01
您导入了库的错误名称(小写)。
导入测试库' selenium2library‘失败: ImportError:没有名为selenium2library的模块
正确的导入语句是:
Library Selenium2Library在测试套件的设置部分,你会看到红色的"selenium2library“,修正后的黑色。
发布于 2019-03-20 12:38:41
添加两个地方,如项目级别和西装级别。
SeleniumLibrary或Selenium2Library
只在“名称”字段上键入&按“确定”。如果它安装在python文件夹中,它将自动添加。


https://stackoverflow.com/questions/41291101
复制相似问题