Sorting a column in alphabetical order using Selenium

139 views
Skip to first unread message

bjscott

unread,
Oct 13, 2014, 11:00:19 AM10/13/14
to seleniu...@googlegroups.com
I am looking for the command that will sort a column in alphabetical order before it continues on with a test?
I have an automated script that has a sticky setting on sorting, sot he first time it runs through the test it sorts in alphabetical ascending order, and the next time it remembers this setting so it's already in the order I want it to be in. I need a selenium command that will check to make sure it is always in alphabetical ascending order and, if not, places it in this order.

Any help would be appreciated.

Andreas Tolfsen

unread,
Oct 14, 2014, 9:56:54 AM10/14/14
to seleniu...@googlegroups.com
Can you expand on what “is” is in this context? I don't understand
your question.

Chul Hwa Waldman

unread,
Oct 14, 2014, 11:34:47 AM10/14/14
to seleniu...@googlegroups.com
This really depends on how the order is build up and how they are identified in html.
I would guess it's a list item, my approach would look something like this.

If I would have the site and see how it looks like it would help figuring out what you want to achieve, but anyways.

So in xpath it would look like this

//li[@item='foo']["1"]
//li[@item='foo']["2"]

If you would only check the first or last item 
//li[@item='foo'][first()]
//li[@item='foo'][last()]

In css which is preferable, since it's faster
css=ul#list li:nth-child(1)
css=ul#list li:nth-child(2)


This should get you started in figuring it out.

Oscar Rieken

unread,
Oct 14, 2014, 1:00:12 PM10/14/14
to seleniu...@googlegroups.com
I would think this has more to do with knowing how to sort collections and checking their sorting. I suggest getting a bit more familiar with whatever language you are using to write your code in.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e9365dcf-8206-4474-ad1e-cc3b32be42d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages