Selenium library - Page Should Contain button - failing.

167 views
Skip to first unread message

Suresh Vemuri

unread,
Dec 18, 2013, 4:13:33 AM12/18/13
to robotframe...@googlegroups.com
Env:
Windows XP
RF
Selenium Library

-->>>  Page Should Contain button    name=btnI   <<---  is failing:
"Page should have contained input 'name=btnI' but did not"

If I remove the line, the button was clicked.
Any suggestions?
------------------------------
*** Testcases ***
Get Current Browser Test
   Open Browser  http://google.com/  ff
   Maximize Browser Window
   Page Should Contain button  name=btnI  
   Click button     name=btnI   
---------------------------------------------------------

Suresh Vemuri

unread,
Dec 18, 2013, 4:27:23 AM12/18/13
to robotframe...@googlegroups.com
I created one .html with the code below, and verified.

The reason is, if the button does not have the tag <input>, Selenium Lib does not search for <button> tag which is option two. And it is failing.
-----------
<html><head></head>
<body>
<button type="button" name="Hit" value="Hit"/>
</body>
</html>
--------------------------------------

Kevin O.

unread,
Dec 18, 2013, 1:22:56 PM12/18/13
to robotframe...@googlegroups.com
First of, please confirm if you are using SeleniumLibrary or Selenium2Library. name= as a locator prefix is not supported in SeleniumLibrary except for Flex elements.

Both libraries are coded the same, checking input, then button:
        try:
            self._page_should_contain_element(locator, 'input', message, loglevel)
        except AssertionError:
            self._page_should_contain_element(locator, 'button', message, loglevel)
I would expect "Page should have contained input 'name=btnI' but did not" to be logged, but not be the actual FAIL message for keyword Page Should Contain Button. Please confirm whether this is INFO or FAIL.

Try running with --loglevel DEBUG and analyzing the log or posting it here.

Suresh Vemuri

unread,
Dec 20, 2013, 10:28:50 PM12/20/13
to robotframe...@googlegroups.com
Thanks for your time Kevin!
I am using Selenium2Library. (I use Java)

Error on the console: "Selenium2LibraryNonFatalException: Page should have contained input 'name=Hit' but did not"

As I am just learning RF, I tried to run with "loglevel" keyword (by placing this in the test case), I see error-  No keyword found.



zz.html
testcase.txt

Mukesh T

unread,
Dec 21, 2013, 6:55:26 AM12/21/13
to robotframe...@googlegroups.com
hello,

i ran your test case file (after saving the attached html in my path) as: pybot --loglevel DEBUG Test_Case.txt

, and it passed. 

selenium2library was able to identify the button on this statement:  "Page Should Contain Button | name=Hit"

best,
Mukesh

Suresh Vemuri

unread,
Dec 22, 2013, 8:18:39 AM12/22/13
to robotframe...@googlegroups.com
Thanks for your time Mukesh!

Not sure your version and env.., but I use Java + Selenium2Library.
Now also it failed. Still I am not figured it out.

"Library       Selenium2Library"

Kevin O.

unread,
Dec 23, 2013, 9:56:17 AM12/23/13
to robotframe...@googlegroups.com
Suresh,
I looked at the code and saw the issue in the code and entered an issue on your behalf.

Kevin

Markus Bernhardt

unread,
Dec 23, 2013, 7:17:40 PM12/23/13
to kormbrek@gmail.com Ormbrek, robotframe...@googlegroups.com
OMG. Sorry. That's a mixture of old an new code. I will push out a fix ASAP-

Markus Bernhardt

unread,
Jan 4, 2014, 1:28:52 PM1/4/14
to kormbrek@gmail.com Ormbrek, robotframe...@googlegroups.com
Release 1.4.0.1 containing the fix is out and available at Maven Central.
Cheers,
Markus
Reply all
Reply to author
Forward
0 new messages