selenium2library Click Element not always working

1,551 views
Skip to first unread message

Rob Bovill

unread,
Apr 5, 2013, 1:34:09 PM4/5/13
to robotframe...@googlegroups.com
      Does anyone know how to get the Click Element keyword working?  I have a wait until statement that checks for the element being visible and not disabled, which passes.  The Click Element also passes, but the item wasn't actually selected, so my next check fails.  I saw that Selenium has an bug about this in their system, but they closed it for some reason.


Thanks,

Rob

Tatu aalto

unread,
Apr 7, 2013, 2:16:12 PM4/7/13
to rbo...@gmail.com, robotframe...@googlegroups.com

Ugh

It was closed because the person did complain about Selenium2Library on Selenium user group. Same thing as person owning Audi would complain to Volvo manufacturer that the Audi does not work.

But back to your problem: clicking and selecting the element are two difference things. It might be that click does not select the element, mainly it depends on the browser, operating system and how the webpage is coded.

But could you provide more details about your problem and what you are trying to do, we might be able to help you.

-Tatu

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Rob Bovill

unread,
Apr 8, 2013, 12:53:28 PM4/8/13
to robotframe...@googlegroups.com
      Our web product operates much like an OS, with limitations, of course.  One window acts like a finder/explorer window with lists of folders and files.  The text of the file/folder name is clickable and will open the file or folder.  If I want to select the file/folder, I must click elsewhere in the row, on a checkbox, the blank area around the name, the last modified date, etc.  I key the element off the name using xpath and then traverse the nodes to get to the element I want to click on to select the row.  It looks like this:

Click Element    xpath=//div[contains(text(),"${FolderName}")]/img/../../../../td[1]/div/div

This is just very inconsistent (and ugly).  There are twelve test cases that make use of this and the failure rate is too high and very inconsistent.  It's not the same step failing every time; sometimes they pass, sometimes they don't.  When I run just those suites on my local box, they run pretty well.  When those suites run as part of the larger harness the fail rate jumps.  Clearly there is a timing issue/race condition somewhere, but I can't nail it down.  I have a wait just prior to the Click Element,

Wait Until Page Contains Element    xpath=//span[text()="${FolderName}" and not(@disabled="")]    10s

which keys off the same folder being visible and available in a different pane, or using,

Wait Until Page Contains Element    xpath=//div[contains(text(), '${FolderName}') and not(@disabled="")]/img    10s

which keys off the exact folder I am trying to select.

These tests are just too flaky.  Any thoughts, ideas, suggestions will be greatly appreciated.

Rob

Tatu Aalto

unread,
Apr 9, 2013, 1:17:33 PM4/9/13
to robotframe...@googlegroups.com
Ugh

It is hard to say. Usually when there is timing problems in my application, it is due that application is busy of doing something else (waiting on IO, loading a page and so on). Sometimes the element might be there and one could even click on it but because there is some waiting, click is not registered. This is also problem for your customers and we have build a indicator (element on the webpage) when application is doing something. But my help on the matter is quite limited, because I do not face generally face timing problems (there other problems to be shared) because our UI logic is quite simple.

Ugliness depends on the person, so I can not take stand on that. Generally I tend to prefer css selectors. Because for me, the css selectors is a starting point for discussion how we could automatize testing of this or that UI related thing. Also if I have problem, which is related to the application, I tend to talk with the coder and ponder about the problem with them. So do some digging, read you application logs (or any thing is used for error hunting and solving) and logs generated rated by Robot. Present your findings to your coders/team and try to find solution together. Usually there is solution available.

There is not one-size-fits-for-all solution and that is a blessing because world needs variety. And I am sorry that I do not have solution for you, but your problem feels to be application specific.

-Tatu
--
Reply all
Reply to author
Forward
0 new messages