Selenium2library does not load

I tried a first mini test script from a tutorial and the setting of selenium2library does not load (or whatever).

*** Settings ***
Library selenium2library

I am new to this and I checked many questions and websites to this issue but … I simply do not find a solution. What is my error, what is missing?

Thank you very much for helping.

Configuration and versions:

Windows 10
Python 2.7.14
PyCharm Community 2017.3
IntelliBot Version
pip 9.0.1 from c:\python27\lib\site-packages (python 2.7)
Robot Framework 3.2.2 (Python 2.7.14 on win32)

pip list:
pip (9.0.1)
robotframework (3.2.2)
robotframework-pythonlibcore (2.2.1)
robotframework-selenium2library (3.0.0)
robotframework-seleniumlibrary (4.5.0)
selenium (3.141.0)
setuptools (28.8.0)
urllib3 (1.26.3)

Geckodriver for Firefox:
geckodriver is in C:\bin and environment variable is set as geckodriver.

The pictures shows the mini script with the error in the settings line.

First off, do not use “Selenium2Library” - it is nothing but a wrapper that installs SeleniumLibrary. If tutorial is pointing you to use that, its seriously outdated.

  1. Replace “Library Selenium2Library” with “Library SeleniumLibrary”.
  2. Ensure that you have more than one space between “OpenBrowser”, your url and “Firefox”.

And then report back.

Worth to mention is that What you see as “error” in the IDE might not be an error in robotframework - if your IDE doesn’t use robotframework’s language server protocol, that IDE relies on its own implementation to parse the syntax and can lead to problems within that IDE, not while really executing your resources.

And finally - I’d personally also start thinking about upgrading python to at least 3.7 but that

1 Like

Thank you very much for your response.

  1. I uninstalled selenium2library and installed seleniumLibrary.
    pip install robotframework-seleniumlibrary

The pip list now:
pip (9.0.1)
robotframework (3.2.2)
robotframework-pythonlibcore (2.2.1)
robotframework-selenium2library (3.0.0)
robotframework-seleniumlibrary (3.3.0)
selenium (3.141.0)
setuptools (28.8.0)
urllib3 (1.26.3)

  1. I tried with one and with two spaces between “Open Browser” and “Firefox”. In both cases it is not working. Now the mini script is with two spaces. You wrote “OpenBrowser” and I did “Open Browser” (and tried “OpenBrowser” too) and the documentarty says “Open Browser”. I hope I do get that right).
    [](https://Keyword Open Browser in the doumentation.)

What I do not understand is how the SeleniumLibrary is found? Or how the robot farmework is connected? I ask because the failing message to the script after a run in the PyCharm terminal with
robot -d results Tests
[ ERROR ] Error in file 'C:\Robot\ProjectGoogle\Tests\ErsterFall.robot' on line 2: Non-existing setting 'Library SeleniumLibrary'.

I did not upgarde the Python version yet. I read it is a bit tricky because of the “Path” viariable in the “environment variable” section of Windows 10. If it is really necessary I surely will try that too. For now I consider such update as a recommentaion and not as an obligation to run a test case.


When importing a library you need at least two spaces between Library and SeleniumLibrary.

1 Like

It means that you are not writing the code correctly. Maybe you should at least skim the user guide and Robot Framework User Guide particular section …

A little progess, thanx!

I still struggle with the geckodriver path.
Open Browser Firefox
WebDriverException: Message: ‘geckodriver’ executable needs to be in PATH.

I tried with this:
Set Environment Variable webdriver.geckodriver.driver C:\bin\geckodriver.exe
and the message is:
No keyword with name ‘Set Environment’ found.

Environment variable is set as geckodriver (See picture). How do I address the driver? What is missing?

And thanx for the patience.

there’s a variable called PATH, which is a list of directories separated by ; in windows and : in posix like systems (linux, mac).

In windows, if you open “cmd” and write “where geckodriver”, if the location where geckodriver.exe is in the path, you will see something like this:

jani mikkonen@DESKTOP-P3TPBJF D:\omat\seleniumtestability>where geckodriver

jani mikkonen@DESKTOP-P3TPBJF D:\omat\seleniumtestability>

eg, it prints out a full path to where geckodriver is located.

If its not in the PATH, you will see:

INFO: Could not find files for the given pattern(s).

So, in your case, if your geckodriver.exe is in c:\bin. You should add that to your PATH. Google for “set PATH variable windows” and first entry in the search results will give you exact steps.

Or temporarily, you can add the location to path in same shell you run robot from:

path %PATH%;c:\bin

Yes! Test run complete. Thats it, thank you very much!

I obviously misunderstood the path entry. I listed geckodriver in the list of variables but did not edit the Path entry itself. It worked after restart of PyCharm.

I appreciate it very much that this forum helps on such beginners and newbies questions as well. Thanx again!

1 Like