Importing test library 'RequestsLibrary' failed: ImportError: No module named RequestsLibrary Traceback

20.9k views Asked by At

I am hitting HTTP service using Robot. But it is showing me the following issues

  1. No keyword with name 'Create Session' found.

  2. Importing test library 'RequestsLibrary' failed: ImportError: No module named RequestsLibrary Traceback (most recent call last):

I have installed RequestsLibrary. My TC is:

*** Settings ***
Library  Collections
Library  String
#Library  RequestsLibrary
Library  OperatingSystem
Library    ExtendedRequestsLibrary
Suite    Teardown  Delete All Sessions

*** Test Cases ***
Get Requests
    [Tags]  get
    Create Session  google  http://www.google.com
#    Create Session  github  https://api.github.com

    ${resp}=  Get  google  /
    Should Be Equal As Strings  ${resp.status_code}  200

    ${resp}=  Get  github  /users/bulkan
    Should Be Equal As Strings  ${resp.status_code}  200
    Dictionary Should Contain Value  ${resp.json()}  Bulkan Evcimen
1

There are 1 answers

0
Todor Minakov On

The error is that the RequestLibrary is not installed, but the source you've posted actually imports ExtendedRequestsLibrary. You need to have it installed:

pip install robotframework-extendedrequestslibrary

The command to install RequestLibrary - the one that is commented - is:

pip install robotframework-requests

As the library (libraries) were not installed, you got the first error - the Create Session is defined in them, and w/o the library Robot Framework does not find it.