Keyword not found in Selenium2Library

2,680 views
Skip to first unread message

Martin Taylor

unread,
Jun 24, 2013, 9:53:51 AM6/24/13
to robotframe...@googlegroups.com
I have the latest Selenium2Library installed from the GitHub source.  If I use it at the Python command-line it works fine like this:

>python
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:20:15) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Selenium2Library
>>> s = Selenium2Library.Selenium2Library()
>>> s.open_browser("http://www.google.com/")
1
>>> s.wait_until_element_is_visible("q")
>>>

But if I run the identical steps in a Robot Framework test case from RIDE:

*** Settings ***
Library           Selenium2Library
Library           OperatingSystem

*** Test Cases ***
Google Example
    Open Browser    http://www.google.com/
    Wait Until Element Is Visible    q
    [Teardown]    Close Browser

Then I always get this failure:
+-- START TEST: Google Example [ ]
------------------------------------------------------------------------------
+--- START KW: Selenium2Library.Open Browser [ http://www.google.com/ ]
Opening browser 'firefox' to base url 'http://www.google.com/'
Opened browser with session id 77f38dda-c6de-8142-8505-d02c5518d4a5
+--- END KW: Selenium2Library.Open Browser (2821)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--- START KW: Wait Until Element Is Visible [ q ]
No keyword with name 'Wait Until Element Is Visible' found.
+--- END KW: Wait Until Element Is Visible (0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--- START TEARDOWN: Selenium2Library.Close Browser [ ]
Closing browser with session id 77f38dda-c6de-8142-8505-d02c5518d4a5
+--- END TEARDOWN: Selenium2Library.Close Browser (32)
------------------------------------------------------------------------------
+-- END TEST: Google Example (2855)

Any idea what might be wrong?

Thanks,
Martin


Tatu Aalto

unread,
Jun 24, 2013, 10:09:38 AM6/24/13
to cmta...@ti.com, robotframe...@googlegroups.com
Ugh

Most likely because there is not a keyword "Wait Until Element Is
Visible" in Selenium2Library [1]. I did not look from source code, what
wait_until_element_is_visible Selenium2Library function does. Perhaps it
is used internally somehow but at least it is not public keyword for
Robot Framework.

But if you want to check is some element in a page, you can use "Wait
Until Page Contains Element"[2] or "Page Should Contain Element"[3]
keywords.

-Tatu
[1]
http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html
[2]
http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html#Wait%20Until%20Page%20Contains%20Element
[3]
http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html#Page%20Should%20Contain%20Element
> --
> 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-u...@googlegroups.com.
> To post to this group, send email to
> robotframe...@googlegroups.com.
> Visit this group at http://groups.google.com/group/robotframework-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Taylor, Martin

unread,
Jun 24, 2013, 11:20:07 AM6/24/13
to Tatu Aalto, robotframe...@googlegroups.com
The " Wait Until Element Is Visible" keyword is in the Selenium2Library KW documentation and is recognized by RIDE as being a Selenium2Library KW.
> +]

Jerry Schneider

unread,
Jun 24, 2013, 11:37:35 AM6/24/13
to robotframe...@googlegroups.com
Actiually there is no keyword "Wait Until Element Is Visible" in the
RobotFramework-Selenium2Library documentation:
http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html

jer
--
Linux registered user #475536
Ubuntu registered user #28583

Taylor, Martin

unread,
Jun 24, 2013, 11:49:47 AM6/24/13
to jer...@gmail.com, robotframe...@googlegroups.com

Then what's this in RIDE?

 

Jerry Schneider

unread,
Jun 24, 2013, 11:59:48 AM6/24/13
to Taylor, Martin, robotframe...@googlegroups.com
Sorry, I am not seeing this in the keyword search on my system in which I have v1.2.0 of RobotFramework-Selenium2Library installed.  I am not seeing it in the Keyword documentation link that I included below either.  Is this part of a locally modified library or the trunk right now? 

I would suspect that this is exactly why you are having problems with the keyword though.  It is not part of the default library right now, but is partially link/setup on your system.

jer

Taylor, Martin

unread,
Jun 24, 2013, 1:12:25 PM6/24/13
to jer...@gmail.com, robotframe...@googlegroups.com

I have version 1.2.0 of robotframework-Selenium2Library installed.  I forked the project on GitHub and downloaded my fork onto my PC.  I have NOT made any code changes, yet, to the downloaded Selenium2Library.  I built on Win7 with Python 2.7 it by doing:

  cd C:\_GIT_\robotframework-selenium2library

  python setup.py install

 

When I add Selenium2Library into a test suite in RIDE, it finds this KW method (in C:\_GIT_\robotframework-selenium2library\src\Selenium2Library\keywords\_waiting.py) and displays its documentation:

 

    def wait_until_element_is_visible(self, locator, timeout=None, error=None):

        """Waits until element specified with `locator` is visible.

 

        Fails if `timeout` expires before the element is visible. See

        `introduction` for more information about `timeout` and its

        default value.

 

        `error` can be used to override the default error message.

 

        See also `Wait Until Page Contains`, `Wait Until Page Contains

        Element`, `Wait For Condition` and BuiltIn keyword `Wait Until Keyword

        Succeeds`.

        """

        def check_visibility():

            visible = self._is_visible(locator)

            if visible:

                return

            elif visible is None:

                return error or "Element locator '%s' did not match any elements after %s" % (locator, self._format_timeout(timeout))

            else:

                return error or "Element '%s' was not visible in %s" % (locator, self._format_timeout(timeout))

        self._wait_until_no_error(timeout, check_visibility)

 

 

This raises 2 questions:

1.      Why can’t this KW be found when running a test case with pybot?

2.      Why does this method exist in this source file if it is NOT a KW method?

 

Thanks,

Martin

Taylor, Martin

unread,
Jun 24, 2013, 1:15:08 PM6/24/13
to Taylor, Martin, jer...@gmail.com, robotframe...@googlegroups.com

OOPS, I take it all back.  This KW IS now visible and working when run with pybot.  To get around some other issues I just upgraded my underlying Selenium to version 2.33 and now LOTS of stuff is working better!

 

Sorry for the trouble…

 

Martin

Kevin O.

unread,
Jun 24, 2013, 1:34:46 PM6/24/13
to robotframe...@googlegroups.com, Taylor, Martin, jer...@gmail.com
I wrote that keyword. Hopefully we can add more of the waiting keywords Markus implemented in the Java port soon.
So was the problem that you had the release version of Selenium2Library in a location that the interpreter was finding first (but not RIDE), rather than using the trunk version you installed into site-packages?

Kevin

Taylor, Martin

unread,
Jun 24, 2013, 2:59:16 PM6/24/13
to Kevin O., robotframe...@googlegroups.com, jer...@gmail.com

I’m not sure.  I had several old versions of Selenium2Library installed, and an old version of the underlying Selenium library.  I deleted them ALL from site-packages and then re-built Selenium2Library.  It claimed to have installed its dependencies, but it didn’t and no Selenium was installed.  The Library import showed red in RIDE.  I had to manually install version 2.33 of Selenium for Python.  Then it all started working.

 

Cheers,

Martin

 

From: Kevin O. [mailto:korm...@gmail.com]
Sent: Monday, June 24, 2013 12:35 PM
To: robotframe...@googlegroups.com
Cc: Taylor, Martin; jer...@gmail.com
Subject: Re: Keyword not found in Selenium2Library

 

I wrote that keyword. Hopefully we can add more of the waiting keywords Markus implemented in the Java port soon.

Andrea Bisello

unread,
May 19, 2016, 9:51:55 AM5/19/16
to robotframework-users, korm...@gmail.com, jer...@gmail.com
i have the same problem on Windows 7 with those packages version (every packages should be on last version)

robotframework (3.0)
robotframework-requests (0.4.0)
robotframework-ride (1.5.2.1)
robotframework-selenium2library (1.7.4)
selenium (2.53.2)

beh when i ask for

Element Should Be Visible css=.myClass

i obtain

No keyword with name 'Element Should Be Visible' found.


Andrea Bisello

unread,
May 19, 2016, 10:14:51 AM5/19/16
to robotframework-users, korm...@gmail.com, jer...@gmail.com
NOPE.

*** Settings ***

is missing before loading library.

SOLVED.
Reply all
Reply to author
Forward
0 new messages