So far I know, it is quite tough to verify sorting order of elements in Selenium IDE (if anybody know a best way please let me know). My application had sorting order change feature and I could easily script in Selenium IDE by using dragAndDrop(). But problem was that I did not have knowledge on how to verify whether the sorting order was changed or not.

Here image-1 showing the deafult order (Here 'Conditon' is the top item):



Here image-2 showing the order is changed by dragging and dropping (here 'Care Setting' is the top item):


Selenium IDE has a command storeHtmlSource() which stores the whole HTML code in a variable. After I've come to know about this command, something blinked in my mind. Selenium IDE allows to use javascript, that we all know. So, what I did that I actually checked presence of a small chunk of code in the whole HTML code. And if it is found the right way, I can assure that the sorting order was changed. Let  us see how I did I do it:

Before I change the sorting order this is the code snipet (image-3) for the top tow items:


And after I change the sorting order, this is the code (image-4):


Carefully notice the difference between the code of Image-3 and Image-4. For you easy eye scanning, here goes image-5 with the difference:



So, what I did is that, I verified the tiny chunk of HTML source code after changing sorting order and again after changing it back to original order (image-6):


So, here (in Image-6) I've stored the HTML source by storeHtmlSource() command. Then I also stored the tiny code in a variable var_HTMLCodeSnipet and then if checked by by javascript if my code snipet is found in the HTML source code or not. If it is found it should return gerater than zero. In image-6, you can see all are green, that mean my test case passed to verify the sorting order. :)

Add new comment