如何检查selenium2library是否已添加到RIDE中的robotframework项目中

Jef*_*eff 2 python robotframework

我是Robot Framework的新手

我正在使用RIDE 1.5.2.1跑步Python 2.7.13.在我的机器上安装Python后,我执行了以下操作,以安装Selenium2Library:

python -m pip install robotframework-selenium2library
Run Code Online (Sandbox Code Playgroud)

而这似乎已将其安装到路径:

C:\Python27\Lib\site-packages
Run Code Online (Sandbox Code Playgroud)

现在,我想将selenium2library添加到RIDE中的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
Run Code Online (Sandbox Code Playgroud)

但它失败了这个错误:

[ 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
Run Code Online (Sandbox Code Playgroud)

看来,它没有找到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)
Run Code Online (Sandbox Code Playgroud)

我很困惑,似乎我已经有了selenium2library,但是RIDE找不到了吗?

Shi*_*ijo 6

请按照本网站上的说明 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
    ...
Run Code Online (Sandbox Code Playgroud)