SeleniumLibrary: Verify table row order?

846 views
Skip to first unread message

Claes

unread,
Feb 5, 2009, 2:14:51 AM2/5/09
to robotframework-users
I'm trying to run a GUI-regression test suite where the main content
is a table. The table can be sorted in several different ways.

My example: Asking for a page for the customer=1234567 I will get a
page with a table like this:

Date Name Code
090204 Name1 Code1
090203 Name2 Code1
090202 Name3 Code2
090201 Name1 Code1
090130 Name4 Code2

What I want to do is to verify that
a) for the specific customer the correct data is displayed
b) the sorting is done properly (per Date, Name and Code)

How do I verify when sorted by date (descending) that the table should
look like:
Row 1: 090204 Name1 Code1
Row 2: 090203 Name2 Code1
etc.

And sorted by Name (ascending)
Row 1: 090204 Name1 Code1
Row 2: 090201 Name1 Code1
Row 3: 090203 Name2 Code1
etc.

My question:
How do I program Robot Framework/SeleniumLibrary to verify that the
content is displayed in correct order?

Thanks
/Claes

Janne Härkönen

unread,
Feb 5, 2009, 3:43:51 AM2/5/09
to claes...@gmail.com, robotframework-users
On Thu, Feb 5, 2009 at 9:14 AM, Claes <claes...@gmail.com> wrote:
>
> I'm trying to run a GUI-regression test suite where the main content
> is a table. The table can be sorted in several different ways.
>
> My example: Asking for a page for the customer=1234567 I will get a
> page with a table like this:
>
> Date Name Code
> 090204 Name1 Code1
> 090203 Name2 Code1
> 090202 Name3 Code2
> 090201 Name1 Code1
> 090130 Name4 Code2
>
> My question:
> How do I program Robot Framework/SeleniumLibrary to verify that the
> content is displayed in correct order?

Hello,

This can currently be done only with Javascript.
That will not be feasible though, because the javascripts would become
a maintenance nightmare.

I have been thinking about this also earlier and actually created an
issue for it:
http://code.google.com/p/robotframework-seleniumlibrary/issues/detail?id=27

This will most likely implemented in next release of SeleniumLibrary,
although when that might be released is yet to be determined.


best regards,
__janne

Pekka Klärck

unread,
Feb 5, 2009, 5:41:36 AM2/5/09
to janne.t....@gmail.com, claes...@gmail.com, robotframework-users
2009/2/5 Janne Härkönen <janne.t....@gmail.com>:

> On Thu, Feb 5, 2009 at 9:14 AM, Claes <claes...@gmail.com> wrote:
>>
>> I'm trying to run a GUI-regression test suite where the main content
>> is a table. The table can be sorted in several different ways.
>>
>> My example: Asking for a page for the customer=1234567 I will get a
>> page with a table like this:
>>
>> Date Name Code
>> 090204 Name1 Code1
>> 090203 Name2 Code1
>> 090202 Name3 Code2
>> 090201 Name1 Code1
>> 090130 Name4 Code2
>>
>> My question:
>> How do I program Robot Framework/SeleniumLibrary to verify that the
>> content is displayed in correct order?
>
> I have been thinking about this also earlier and actually created an
> issue for it:
> http://code.google.com/p/robotframework-seleniumlibrary/issues/detail?id=27

Table related keywords are definitely needed. It might, however, be
easier to create custom keyword at least for complex tables. Verifying
all the rows and columns is so much more easy in Python code as using
the simple constructs that are available in the test data. Adding
custom keywords is pretty easy, you can start with something like

from SeleniumLibrary import SeleniumLibrary

class MySeleniumLibrary(SeleniumLibrary):

def my_special_keyword(self, arg1, arg2):
# do something ...


Cheers,
.peke

Reply all
Reply to author
Forward
0 new messages