unable to add Selenium2Library in RIDE

4,207 views
Skip to first unread message

GAURAV DEORE

unread,
Oct 28, 2012, 1:42:40 AM10/28/12
to robotframe...@googlegroups.com
Hello,

As I am using RobotFramework 2.7.4 & RIDE version 0.51. As I wanted
to use Selenium2Library instead of SeleniumLibrary so I installed
Selenium2Library and tried to used it in RIDE but its not accepting
it, showing its in RED color.
Even as I tried to see search it from from Search keyword, no keywords
are getting there related to Selenium2Library. So please help me to
know where I am incorrect to access Selenium2Library keywords.

Thanks a lot !

--
------------------------------
Warm Regards,
GAURAV S. DEORE.

Pekka Klärck

unread,
Oct 29, 2012, 6:45:37 AM10/29/12
to gaur...@gmail.com, robotframe...@googlegroups.com
2012/10/28 GAURAV DEORE <gaur...@gmail.com>:
>
> As I am using RobotFramework 2.7.4 & RIDE version 0.51. As I wanted
> to use Selenium2Library instead of SeleniumLibrary so I installed
> Selenium2Library and tried to used it in RIDE but its not accepting
> it, showing its in RED color.

Did you take Selenium2Library into use in your test data? RIDE doesn't
know about libraries installed into your system otherwise. If that
doesn't work, you can take a look does at RIDE's log (Tools > View
RIDE Log) contain anything suspicious.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

Pekka Klärck

unread,
Oct 29, 2012, 6:49:33 PM10/29/12
to jackaly...@smarttech.com, robotframe...@googlegroups.com
2012/10/30 jackie <jackaly...@smarttech.com>:
>
>> I am having the same problem. However, I import Selenium2Library via
>> common_resource.txt resource file (as done in demo).
>
> Then in my testcase I use "Open Browser" and "Close Browser" keywords (they
> appear light blue so RIDE does recognize them and if I hover over them a
> yellow pop-up window tells me that it is from Selenium2Library.
>
> However, when I run the test script, I get the following error:
[snip]
> [ ERROR ] Invalid syntax in file 'C:\AutomationScripts\product\SMART
> Ink\trunk\tests\common_resource.txt' in table 'Settings': Importing test
> library 'Selenium2Library' failed: ImportError: No module named
> Selenium2Library
> PYTHONPATH: [u'C:\\AutomationScripts\\product\\SMART Ink\\trunk\\libs',
[snip]
> CLASSPATH: robotframework.jar;libs/sikuli_win/sikuli-script.jar
> Traceback (most recent call last):
> File "C:\AutomationScripts\product\SMART
> Ink\trunk\robotframework.jar\Lib\robot\utils\importing$py.class", line 86,
> in _non_dotted_import

Based on the above error message you are running your tests on Jython.
RIDE runs on Python and it being able to import a library does not
mean that Jython can.

In your case the bigger problem is that Selenium 2 itself, and thus
also Selenium2Library, require Python interpreter version 2.6 or 2.7,
and there is only Jython 2.5 available. Some people have tested that
the available Jython 2.7 betas work both with Robot Framework and
Selenium2Library, though.

GAURAV DEORE

unread,
Oct 29, 2012, 10:49:19 PM10/29/12
to Pekka Klärck, robotframe...@googlegroups.com
Hi,

Yes, ur right its showing error details as its Fail to import
Selenium2Library in RIDE.

Below is the error details I took from Tools> View RIDElog ----------->

20121030 07:08:03.337 [INFO]: Started RIDE 0.51 using python version
2.7.3 with wx version 2.8.12.1 in win32.

20121030 07:08:07.428 [WARN]: Importing test library "Selenium2Library" failed

Traceback (most recent call last):
Importing test library 'Selenium2Library' failed: ImportError: No
module named decorator
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 1, in <module>
from _logging import _LoggingKeywords
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_logging.py",
line 5, in <module>
from keywordgroup import KeywordGroup
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\keywordgroup.py",
line 4, in <module>
from decorator import decorator
PYTHONPATH:
C:\Python27\lib\site-packages\robotide\lib\robot\libraries
C:\Python27\lib\site-packages\robotide\lib
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
c:\Python27\Scripts
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
.
C:\Python27\lib\site-packages\robotide\spec
File "C:\Python27\lib\site-packages\robotide\spec\librarymanager.py",
line 75, in _fetch_keywords
return get_import_result(path, library_args)
File "C:\Python27\lib\site-packages\robotide\spec\libraryfetcher.py",
line 20, in get_import_result
lib = TestLibrary(path, args)
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py",
line 37, in TestLibrary
libcode = importer.import_class_or_module(name)
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py",
line 64, in import_class_or_module
self._raise_import_failed(name, err)
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py",
line 102, in _raise_import_failed
raise DataError('\n'.join(msg))

Please revert back with solutions on this.

Thanks,
Gaurav

Mikko Korpela

unread,
Oct 30, 2012, 12:07:36 AM10/30/12
to gaur...@gmail.com, Pekka Klärck, robotframe...@googlegroups.com
Hi,

Selenium2Library installation documentation says that decorator module needs to be installed separately.


Hope this helps!
Mikko Korpela
--
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.
For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.

jackie

unread,
Oct 30, 2012, 1:45:45 PM10/30/12
to robotframe...@googlegroups.com, jackaly...@smarttech.com
I am running using a custom script that in turn is using robot framework Jar.
The reason I need to run with robot framework Jar is to integrate with sikuli.
 
When I user the execution profile: pybot - everything is fine (except of course that I cannot include/import my sikuli library)...
 
Is there anyway to make selenium and Selenium2Library availble when I run with robot framework jar file?

GAURAV DEORE

unread,
Oct 31, 2012, 6:15:02 AM10/31/12
to Mikko Korpela, Pekka Klärck, robotframe...@googlegroups.com
Hi Mikko,

I did it as u explained with help of mentioned URL but still
Selenium2Library is not accessible. When I went to the Python prompt &
text import Selenium2Library. Its showing message at the end like -

From Selenium import Webdriver
ImportError:No Module name Selenium

So to solve this What should I do? Shall I add Selenium.py from
SeleniumLIbrary or Do need to add any other selenium module?

Even I mentioned Path C:\Python27\Lib\site-packages in Environment
variable. - Is it necessary to mentioned it?

Please Clear me to go ahead to use of Selenium2Library.

Thanks,
Gaurav Deore

Tatu aalto

unread,
Oct 31, 2012, 7:23:07 AM10/31/12
to gaur...@gmail.com, Pekka Klärck, Mikko Korpela, robotframe...@googlegroups.com

Ugh

Based on the error you have not installed all the dependencies of the selenium2library. Use the url provided by Mikko and install all the dependecies.

The easiest way to install python packages, in Windows at least, is to use pip.

-Tatu

GAURAV DEORE

unread,
Oct 31, 2012, 8:16:29 AM10/31/12
to Tatu aalto, Pekka Klärck, Mikko Korpela, robotframe...@googlegroups.com
I have install all required, right now unable to install Selenium
2.8.1. Pleas guide on this only. Is need to set path & then install
it? By pip its not installing on windows 7.

Thanks,
Gaurav

GAURAV DEORE

unread,
Oct 31, 2012, 2:15:10 PM10/31/12
to Jackie Sproat, robotframe...@googlegroups.com
Thanks Jackie!

I have installed all pre-requisites setups for robor Framework
Selenium2Library. but now as I went to Python Commond prompt to check
whether Selenium2Library is accessible. so run import Selenium2Library
& ots showing "cannot import name Select "

For details plz see attachement.

Thanks,
Gaurav






On Wed, Oct 31, 2012 at 7:12 PM, Jackie Sproat
<Jackie...@smarttech.com> wrote:
> Here are the steps I followed when pip failed for me as well:
>
> 1. Run: pip install Selenium
> WARNING: Unknown distribution option: 'src_root'
> SOLUTION:
> 2. Download selenium tar ball-extract
> 3. Run: CMD.EXE (cd to the folder where files were extracted)
> 4. type python setup.py install
> 5. type python (gets python interpreter prompt)
> 6. type from selenium import webdriver
> If import works but, still RF reports No module named selenium or Selenium2Library. Ensure you are using pybot (not jybot) Execution Profile!!!
Import Selenium2Lib.png

Kevin O.

unread,
Oct 31, 2012, 2:47:44 PM10/31/12
to robotframe...@googlegroups.com, Jackie Sproat
Sounds like something went wrong during the installation of Selenium.  Did you install distribute first? (http://pypi.python.org/pypi/distribute).
Feel free to delete the <Python folder>/Lib/site-packages/selenium folder and try again.

Tatu Aalto

unread,
Oct 31, 2012, 2:50:19 PM10/31/12
to gaur...@gmail.com, Jackie Sproat, robotframe...@googlegroups.com
Ugh

Pip works fine for me in Windows 7 and for many others. It must be noted
that pip might fail sometimes, when it fails to download required
packages. For me this has been quite frequently, but in the end (with
some re-tries), it manages to install all that I need. Can not say what
is the particular problem with pip in your case.

But back to you problem with Selenium2library. In the Selenium2library,
at file _selectelement.py, in line 2 is this:
from selenium.webdriver.support.ui import Select. More problematic is
that, in the line 1 is this:
from selenium.webdriver.remote.webelement import WebElement

With my limited knowledge this implies that selenium installation was
not successful or was only partially successful. Could do the following
and send the hole output:
0) Run: CMD.EXE
1) Type: python --version
2) Type: python
You should see python prompt >>>
3) Type: from selenium.webdriver.remote.webelement import WebElement
4) Type: from selenium.webdriver.support.ui import Select
5) Type: import selenium
6) Type: import Selenium2Library

GAURAV DEORE

unread,
Nov 1, 2012, 12:11:48 AM11/1/12
to Tatu Aalto, Jackie Sproat, robotframe...@googlegroups.com
Hi Tatu,

As per your given steps 

0) Run: CMD.EXE
1) Type: python --version
2) Type: python
You should see python prompt >>>
3) Type: from selenium.webdriver.remote.webelement import WebElement
4) Type: from selenium.webdriver.support.ui import Select ----------------------- Fail
5) Type: import selenium
6) Type: import Selenium2Library ------------------------ Fail

Please find the output as below:-

>>> from selenium.webdriver.support.ui import Select
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name Select
>>> import selenium
>>> import Selenium2Library
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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 7, in <module>
    from _selectelement import _SelectElementKeywords
  File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_selectelement.py", line 2, in <module>
    from selenium.webdriver.support.ui import Select
ImportError: cannot import name Select
>>>


Thanks,
Gaurav 


To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/robotframework-users?hl=en.



--
------------------------------
Warm Regards,
GAURAV S. DEORE.

--
You received this message because you are subscribed to the Google
Groups "robotframework-users" group.
To post to this group, send email to

To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/robotframework-users?hl=en.



--
------------------------------
Warm Regards,
GAURAV S. DEORE.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To post to this group, send email to robotframework-users@googlegroups.com.
To unsubscribe from this group, send email to robotframework-users+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.



Tatu aalto

unread,
Nov 1, 2012, 6:34:35 AM11/1/12
to GAURAV DEORE, Jackie Sproat, robotframe...@googlegroups.com

Ugh

Well, something went wrong with the selenium installation.

Follow the Kevin instructions to delete the selenium installation folder. Then try re-install the selenium again.

When done the installation, try the python commands, from my post, again. If errors appear send the full log. Full log means all output from installation and the python commands.

-Tatu

GAURAV DEORE

unread,
Nov 1, 2012, 10:42:45 PM11/1/12
to Tatu aalto, korm...@gmail.com, Jackie Sproat, robotframe...@googlegroups.com
Hello Tatu/Kevin,

 AS per Kevin's guideline, 
1) I have removed the Selenium from location C:\Python27\Lib\site-packages\selenium-2.8.1-py2.7.egg then
 2) Installed the "distribute-0.6.30" so get it at location  the C:\Python27\Lib\site-packages\distribute-0.6.30-py2.7.egg ... Also in attachment initial log u can see for this.
3) Installed  Selenium 2.8.1  so get it at location  C:\Python27\Lib\site-packages\selenium-2.8.1-py2.7.egg .. attachment has installation for this too.
4) then came on python prompt to check whether its proper or so entered -- import selenium - which is fine 
5) When I ran the "import Selenium2Library"  then it shows me ImportError : which is attached in log file. 

Please find the all installation log details as attachment.
Hope it gives you complete idea to find the problem.

Thanks,
Gaurav 
Selenium Installation Log .txt

Tatu Aalto

unread,
Nov 2, 2012, 3:27:39 AM11/2/12
to GAURAV DEORE, korm...@gmail.com, Jackie Sproat, robotframe...@googlegroups.com
Ugh

I have wild ques, what might be wrong. Where did get the selenium version that you did install? I am asking this because, when I look the selenium download page, the latest version of Python selenium is 2.26.0 [1]. But based on your log, you are installing version 2.8.1. Although it seems to install selenium, I do not know what is it.

Please note that the Selenium2library is tested with selenium version 2.25.0, although it should be possible use also selenium version 2.26.0. But because of your problems, I would play on safe and install the selenium version 2.25.0 [2].

Could you download the selenium version 2.25.0 and install it and then see then how the python import goes.

-Tatu

[1] http://pypi.python.org/pypi/selenium
[29 http://pypi.python.org/packages/source/s/selenium/selenium-2.25.0.tar.gz

To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/robotframework-users?hl=en.



--
------------------------------
Warm Regards,
GAURAV S. DEORE.

--
You received this message because you are subscribed to the Google
Groups "robotframework-users" group.
To post to this group, send email to

To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/robotframework-users?hl=en.



--
------------------------------
Warm Regards,
GAURAV S. DEORE.

--
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.

For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.






--
------------------------------
Warm Regards,
GAURAV S. DEORE.

Ed Manlove

unread,
Nov 2, 2012, 12:07:11 PM11/2/12
to GAURAV DEORE, aalto...@gmail.com, robotframe...@googlegroups.com
On 11/02/2012 03:27 AM, Tatu Aalto wrote:
Ugh

I have wild ques, what might be wrong. Where did get the selenium version that you did install? I am asking this because, when I look the selenium download page, the latest version of Python selenium is 2.26.0 [1]. But based on your log, you are installing version 2.8.1. Although it seems to install selenium, I do not know what is it.

Please note that the Selenium2library is tested with selenium version 2.25.0, although it should be possible use also selenium version 2.26.0. But because of your problems, I would play on safe and install the selenium version 2.25.0 [2].

Could you download the selenium version 2.25.0 and install it and then see then how the python import goes.

-Tatu

[1] http://pypi.python.org/pypi/selenium
[29 http://pypi.python.org/packages/source/s/selenium/selenium-2.25.0.tar.gz


Gaurav,

Tatu is correct in that your selenium version is fairly old, to old in fact for our recent changes. I've added an issue to our issue tracker [1]. I would also recommend that you use pip - http://www.pip-installer.org - to install selenium.

Ed

[1] https://github.com/rtomac/robotframework-selenium2library/issues/140

GAURAV DEORE

unread,
Nov 2, 2012, 2:31:48 PM11/2/12
to Ed Manlove, aalto...@gmail.com, robotframe...@googlegroups.com
Yes Tatu and Ed. Its finally get installed.

Thanks a lot for this help.

Gaurav

Pekka Klärck

unread,
Nov 2, 2012, 4:55:57 PM11/2/12
to Jackie Sproat, robotframework-users
[Replying also to robotframework-users. Please keep it in Cc in
possible future replies.]

2012/11/2 Jackie Sproat <Jackie...@smarttech.com>:
> I have installed Jython2.7a2, but, I believe now I have to create a new robotframework JAR (on Jython2.7a2).

You don't need to create new standalone robotframework.jar to test
does Selenium 2, and Selenium2Library, work on Jython 2.7. Just
install Selenium2Library on Jython 2.7 and see does it work. If I've
understood it correctly, pip works with Jython 2.7 so you probably
should start by getting it installed. Otherwise you need to install
all Selenium2Library dependencies manually.

> Can you direct me to some step-by-step instructions on how to do this (if any)...
> Apparently (https://groups.google.com/forum/?fromgroups#!topic/robotframework-devel/Ty4mJVP8_l8) this is not a straightforward task.

That shouldn't be too complicated. I'll check the above thread and
comment more there.
Reply all
Reply to author
Forward
0 new messages