Verify order of elements : Automation API

Verify order of elements

Class library usage, coding and language questions.

Verify order of elements

Postby Rakesh123 » Thu Dec 01, 2011 4:12 am

Hi Frnds,
I have a small requirement.I am doing automation testing for an application developed in Delphi. I have some 'n' number of elements inside the parent node of the Tree.When I select the parent node & click on button all the child nodes should be added in the panel which is beside the tree.

Till here its fine..

I need to verify whether the items are displayed in correct order or not.

Its not alphabetical order.Actually they have given some order.For Eg:If there are 3 child nodes(A,B,C),they should be displayed in the panel as C,A,B but not as A,B,C

So,pls help me out in solving this ASAP.

Please don't send any urls..

Thanks,
Rakesh
Rakesh123
 
Posts: 10
Joined: Thu Oct 28, 2010 3:18 pm

Re: Verify order of elements

Postby Support Team » Thu Dec 01, 2011 10:50 am

Hi,

Please provide more details about the context you are trying to verify the order (within spy? within the code?...).
Also tell me what exactly you are trying to do.
Thanks.

Best Regards,
Martin
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Verify order of elements

Postby Rakesh123 » Fri Dec 02, 2011 6:33 am

Hi,
I am trying to verify the sorting order of the tree items included in panel using ranorex code(C#).

Thanks,
Rakesh
Rakesh123
 
Posts: 10
Joined: Thu Oct 28, 2010 3:18 pm

Re: Verify order of elements

Postby Support Team » Fri Dec 02, 2011 4:17 pm

Hi,

I think the following code provides the needed functionality:
var yourVar = repo.YourElement.TheParentElement;
      IList<ListItem> list = TheParentElement.FindChildren<ListItem>();
      
      int i = 0;
      bool rightOrder = true;
      String[] checkText = new String[3];
      checkText[0] = "YourText1";
      checkText[1] = "YourText2";
      checkText[2] = "YourText3";

      foreach(ListItem item in list){
        
        if(item.Text!=checkText[i])
          rightOrder= false;
        
        i++;
      }
      
      if(rightOrder)Report.Info("Right order!!!");


Regards,
Markus
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests

cron