Pagination Test using Selenium Library

1,096 views
Skip to first unread message

Cristian

unread,
Apr 14, 2010, 10:38:38 AM4/14/10
to robotframework-users
How is the best way for do that?
Sometimes there are less elements than the size of the page, so there
isn't any "next" link in the table. Even so, there is, sometimes, more
elements and I have to check the complete list, that means, I have to
move between the pages using the next link.

The problem is with SeleniumLibrary, because if the link is not in the
page, I will get an error. I know that Robot doesn't have "if - else"
conditionals, but in this case I think could be helpful.
It was solved using the keyword: "Run Keyword And Ignore Error" and an
auxiliary keyword with the link (If the link is not in the page, it
will be stopped but the test will not fail).

Is there another better way to do that?

Cheers,
Cristian

Carl Dichter

unread,
Apr 14, 2010, 10:48:03 AM4/14/10
to cmal...@gmail.com, robotframework-users
Use the keyword:
Run Keyword and Ignore Error


Sent on the Sprint® Now Network from my BlackBerry®
--
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.

Radek

unread,
Apr 14, 2010, 10:51:36 AM4/14/10
to robotframework-users
I use "Run Keyword If' in those cases. I would implement a keyword
that does "Page Should Contain Element" to check if your Next link
exists and returns some value. I'd then check for that value in "Run
Keyword If" and execute some other keyword, in your case another
keyword that checks all elements in the table.

But why not test with a know data set and have a constant and
predictable number of rows in your table?

--
Radek

Pekka Klärck

unread,
Apr 14, 2010, 5:50:25 PM4/14/10
to rade...@gmail.com, robotframework-users
2010/4/14 Radek <rade...@gmail.com>:

> I use "Run Keyword If' in those cases. I would implement a keyword
> that does "Page Should Contain Element" to check if your Next link
> exists and returns some value. I'd then check for that value in "Run
> Keyword If" and execute some other keyword, in your case another
> keyword that checks all elements in the table.

This is a good idea. I'd go a step further and have keyword like
`Click link if it exists` so that all the logic is hidden inside it.

> But why not test with a know data set and have a constant and
> predictable number of rows in your table?

This is definitely the best solution for this kind of problems. I know
conditional logic cannot always be avoided, but adding logic into test
cases both makes their maintenance harder and can lead to a situation
where the test status depends on what if/else branch it happens to
execute.

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

Reply all
Reply to author
Forward
0 new messages