Selenium import error when running test case with RobotFramework

29,479

Resolved the problem by removing Selenium2Library folder and reinstalling it with pip command (which installs all necessary packages).

pip install robotframework-selenium2library 
Share:
29,479
finspin
Author by

finspin

Updated on April 08, 2020

Comments

  • finspin
    finspin about 4 years

    I'm getting the below error when I'm trying to run a test case in RobotFramework. I installed Selenium2Library but it looks like RF can't find it. Everything works fine with SeleniumLibrary.

    Selenium2Library is installed in C:\Python27\lib\site-packages. I uninstalled and installed it a few times to make sure the installation is correct. There were no errors during the installations.

    Any ideas where to look for the problem?

    Here is the error:

    c:\testing>pybot testone.txt
    [ ERROR ] Error in file 'c:\testing\testone.txt' in table 'Settings': Importing test library 'Selenium2Library' failed: ImportError: No module named selenium
    Traceback (most recent call last):
      File "C:\Python27\lib\site-packages\Selenium2Library\__init__.py", line 2, in <module>
        from keywords import *
      File "C:\Python27\lib\site-packages\Selenium2Library\keywords\__init__.py", line 3, in <module>
        from _browsermanagement import _BrowserManagementKeywords
      File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_browsermanagement.py", line 4, in <module>
        from selenium import webdriver
    PYTHONPATH:
      C:\Python27\lib\site-packages\robot\libraries
      C:\Python27\lib\site-packages
      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\wx-2.8-msw-unicode