Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium import error when running test case with RobotFramework

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
like image 693
finspin Avatar asked Aug 17 '12 12:08

finspin


1 Answers

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

pip install robotframework-selenium2library 
like image 73
finspin Avatar answered Oct 14 '22 07:10

finspin