Cannot import Selenium2Library

3,442 views
Skip to first unread message

Vladimir Belorusets

unread,
Jul 2, 2012, 7:39:47 PM7/2/12
to robotframe...@googlegroups.com
Hello,

I just installed Robot with Selenium2Library and as a test tried the following simple script

*** Settings ***
Library        Selenium2Library

*** Test Cases ***
Test
    Open Browser    http://www.google.com    firefox
    Close Browser

It gives me the error below
20120702 16:30:54.597 ERROR Error in file 'C:\Robot Scripts\first_test.txt' in table 'Settings': Importing test library 'Selenium2Library' failed: ImportError: No module named decorator Traceback (most recent call last): File "C:\Robot\Python\lib\site-packages\Selenium2Library\__init__.py", line 2, in <module> from keywords import * File "C:\Robot\Python\lib\site-packages\Selenium2Library\keywords\__init__.py", line 1, in <module> from _logging import _LoggingKeywords File "C:\Robot\Python\lib\site-packages\Selenium2Library\keywords\_logging.py", line 5, in <module> from keywordgroup import KeywordGroup File "C:\Robot\Python\lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module> from decorator import decorator PYTHONPATH: C:\Robot\Python\lib\site-packages\robot\libraries C:\Robot\Python\lib\site-packages C:\Robot\Python\python27.zip C:\Robot\Python\DLLs C:\Robot\Python\lib C:\Robot\Python\lib\plat-win C:\Robot\Python\lib\lib-tk C:\Robot\Python . C:\Robot Scripts

Please help.
Thanks


Ed Manlove

unread,
Jul 2, 2012, 8:33:37 PM7/2/12
to vladi...@hotmail.com, robotframe...@googlegroups.com
Vladimir,

You are missing at least one of robotframework-selenium2library's dependencies, decorator, which is another python package. And possible it's other two dependencies, docutils and selenium.  It is recommended that you install robotframework-selenium2library via pip (using the command 'c:\pip install robotframework-selenium2library') which installs robotframework-selenium2library and all of it's dependencies.

If you used easy_install for installation, on Windows, you will need to install each package. So you will need to do something like

  c:\ easy_install decorator
  c:\ easy_install docutils
  c:\ easy_install selenium

as well as installing robotframework-selenium2library and robotframework using

  c:\ easy_install robotframework-selenium2library
  c:\ easy_install robotframework

And if you downloaded the source zip files from PyPI then you should do the same for decorator, docutils, selenium. But once again under windows it is recommended to install using pip.  We are planning on upgrade the documentation to better clarrify this and any feedback is appreciated.

Ed

Tatu aalto

unread,
Jan 26, 2013, 2:07:46 AM1/26/13
to boterh...@gmail.com, robotframe...@googlegroups.com

Ugh

Are you trying to run Selenium2Library with jython? If you are, it does not work out of the box. There are some experiments with beta version of the jython, but I do not personally know how that works out. If you want to use Selenium2Library, you need to run as pure python.

-Tatu

On Jan 25, 2013 6:39 AM, "DJoeri" <boterh...@gmail.com> wrote:
i have installe Selenium2Library with pip, but i still do not succeed to start up :
after the problem of decorator, i have the following issue:

     [java] .... Importing test library 'Selenium2Library' failed: TypeError: Error when calling the metaclass bases
     [java]     'module' object is not callable
     [java] Traceback (most recent call last):
     [java]   File "__pyclasspath__/Selenium2Library/__init__.py", line 2, in <module>
     [java]   File "__pyclasspath__/Selenium2Library/keywords/__init__.py", line 2, in <module>
     [java]   File "__pyclasspath__/Selenium2Library/keywords/_runonfailure.py", line 6, in <module>
     [java]   File "__pyclasspath__/Selenium2Library/keywords/keywordgroup.py", line 24, in __new__


since i'm starting robotframework from within an ant java task, i need to add everything myself in the classpath, so the solution for the decorator problem was, to add the decorator directory in my eclipse project, and add that location in the classpath of my java task. But it did not solve the problem of the "object is not callable" (which is also pointing to the decorator object)

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To post to this group, send email to robotframe...@googlegroups.com.
To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Joeri

unread,
Jan 29, 2013, 4:54:32 AM1/29/13
to Tatu aalto, robotframe...@googlegroups.com
Hello Tatu,

and what have been changed between SeleniumLibrary and Selenium2Library so it does not work anymore? Untill now i have successfully used SeleniuLibrary within this project , so i guess the problems with the installation of Selenium2Library are only due to missing path info.
If i understood it correctly, most of Selenium2Library is backwards compatible.
So i don't think the problem lays in the fact that i'm using Jython.

To be complete:
i installed Jython 2.5.3, my robotframework jar has rev 2.7.6.

Br, Joeri.

Tatu Aalto

unread,
Jan 29, 2013, 5:06:07 AM1/29/13
to Joeri, robotframe...@googlegroups.com
Ugh

Selenium2Library is replacement for the SeleniumLibrary. The internal difference is that Selenium2Libraryuses the selenium webdriver [1] to control the browser and SeleniumLibrary uses the selenium remote control [2] to control the browser.

Because of the implementation changes, in the Selenium2Library (which I do not know anything about), the Selenium2Library does not work with jython. I did ask exactly the same thing and you can read the Pekka's answer from user group [3].

[1] http://seleniumhq.org/projects/webdriver/
[2] http://seleniumhq.org/projects/remote-control/
[3] https://groups.google.com/forum/?fromgroups=#!searchin/robotframework-users/selenium2library$20jython/robotframework-users/12DKi7ia380/D1lSrZNxLu0J

-Tatu

Joeri

unread,
Jan 29, 2013, 5:33:50 AM1/29/13
to Tatu Aalto, robotframe...@googlegroups.com
Tatu,
that is indeed a clear answer.thanks for that.
But the robotframework 2.7.6.jar i'm using already contains the Jython 2.5.3. How do i "upgrade" the robotframework jar to Jython 2.7 in a clean way ?

Joeri.

Joeri

unread,
Jan 29, 2013, 7:58:57 AM1/29/13
to Tatu Aalto, robotframe...@googlegroups.com
Hello Tatu,

following the links you provided,
i tried to install robotframework with jython , after installing Jython 2.7.a2, but i get the following stacktrace:
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: could not locate stub library in jar file.  Tried [jni/x86_64-Windows/jffi-1.2.dll, /jni/
x86_64-Windows/jffi-1.2.dll]

I came across the following workaround : http://bugs.jython.org/issue1889
and tried to copy this new jffi jar into the extlibs dir of my Jython installation (this directory extlibs is b.t.w. only available if you select the full Jython installation, including the sources),

but i still get this error when trying to install roboframework with jython.

Br,

Joeri.


On 29/01/2013 11:06, Tatu Aalto wrote:

Tatu Aalto

unread,
Jan 29, 2013, 8:06:33 AM1/29/13
to Joeri, robotframe...@googlegroups.com
Ugh

Unfortunately I have not experience on the matter. For our CI, we use python version of Robot and Selenium2Library. Although it does not come just downloading jar files, setting it up with pip was quite easy.

Perhaps some one else on the user group can help you on this matter.

-Tatu

Vinodh R

unread,
Sep 23, 2016, 3:19:04 PM9/23/16
to robotframework-users, boterh...@gmail.com
I'm trying the below: Unable to install selenium2library. 

C:\Users\virath>pip install robotframework-selenium2library
Collecting robotframework-selenium2library
  Using cached robotframework-selenium2library-1.8.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\virath\AppData\Local\Temp\pip-build-mgsnlwbj\robotframework
-selenium2library\setup.py", line 7, in <module>
        from ez_setup import use_setuptools
      File "C:\Users\virath\AppData\Local\Temp\pip-build-mgsnlwbj\robotframework
-selenium2library\src\ez_setup.py", line 106
        except pkg_resources.VersionConflict, e:
                                            ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\virath\A
ppData\Local\Temp\pip-build-mgsnlwbj\robotframework-selenium2library\
To unsubscribe from this group, send email to robotframework-users+unsub...@googlegroups.com.

Tatu Aalto

unread,
Sep 24, 2016, 5:49:47 AM9/24/16
to vino...@gmail.com, joeri delvoy, robotframework-users

Ugh

Are you trying to install the Selenium2Library by using Python 3? If you are, then that is not yet supported officially. Python 2.6 and 2.7 are supported officially and there is a fork from the repository which supports Python 3.

-Tatu
Send from my mobile


To unsubscribe from this group, send email to robotframework-users+unsubscrib...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Vinodh R

unread,
Sep 24, 2016, 9:09:20 AM9/24/16
to Tatu Aalto, joeri delvoy, robotframework-users
Agreed, i downgrade to python2.7 and installed. Tnx

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsubscrib...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages