Issue: – We tried adding the Selenium2Libray in robot framework but its shown in red color(in settings) and we are not able to implement any of the keywords.

library comes in red in robot framework


Root cause: – Anything coming in red in settings after importing generally means that particular library is not properly installed.

Let’s check whether we were able to install selenium2library.
Type python in cmd and type “import selenium2library”, in our case it would give the error message something call stack error.
We can visualize the same error after importing selenium2library in ride and going to Tools > View in ride.

View log in Robot framework

We found some files were missing like in our case its decorator dependency that RIDE is not able to locate when loading “Selenium2Library”
No module decorator robot framework
Note: – Most of the time it’s some missing files that are not installed which results in libraries name coming in red on adding to RIDE. Like same can happen on importing “ExcelLibrary” or “Database library”

Solution:- 
Go ahead and install the missing dependency, in our case its “decorator”
Download the dependency
Open the command prompt to the extracted downloaded file
setup.py install

And we are done.

Note:- As discussed same solution can be applied to any external library that is coming as red on importing into RIDE inside settings tab.

Learn Robot Framework

One Reply to “Importing an library in Robot Framework comes in RED color.”

  1. Hi,

    I have installed below things but still selenium2Library is not properly importing

    decorator==4.1.2
    Pygments==2.2.0
    robotframework==3.0.2
    robotframework-ride==1.5.2.1
    robotframework-selenium2library==1.8.0
    selenium==3.7.0

    Could you please help me to resolve this?

Leave a Reply

Your email address will not be published. Required fields are marked *