我对机器人框架很陌生
我正在使用RIDE 1.5.2.1Python 2.7.13上运行。
在我的机器上安装了Python之后,我执行了以下步骤来安装selenium2库:

python -m pip install robotframework-selenium2library

似乎已经安装到路径上了:
C:\Python27\Lib\site-packages

现在,我想在RIDE中将selenium2库添加到我的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

它似乎找不到selenium2库,但当我再次尝试安装它时,它说:
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)

最佳答案

请按照本网站上的说明操作
https://github.com/robotframework/RIDE/wiki/Installation-Instructions
一旦您将其与PIP一起安装-https://github.com/robotframework/robotframework/blob/master/INSTALL.rst#installing-with-pip
可以使用“pip freeze”命令检查库的安装版本
还要确保使用python安装的文件夹和脚本文件夹更新PATH变量
一旦您知道安装了所有必需的库,就可以导入selenium库

    *** Settings ***
    Documentation     A test suite with a single test for valid login.
    Library           Selenium2Library
    ...

10-07 12:24