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
Verify order of elements
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Verify order of elements
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
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
Re: Verify order of elements
Hi,
I am trying to verify the sorting order of the tree items included in panel using ranorex code(C#).
Thanks,
Rakesh
I am trying to verify the sorting order of the tree items included in panel using ranorex code(C#).
Thanks,
Rakesh
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Verify order of elements
Hi,
I think the following code provides the needed functionality:
Regards,
Markus
Ranorex Support Team
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) rightOrder= false; i++; } if(rightOrder)Report.Info("Right order!!!");
Regards,
Markus
Ranorex Support Team
Re: Verify order of elements
Hi Marcus,
The code provided by you was very good.
But I have small problem with that.
Like you have mentioned,you assigned the items order in an string array & with each element in the list u r comparing with the 1st,2nd,3rd item in an array.
So assume that i compared the first element of the list with first element in an array.It matched and 'rightOrder' will be 'true'
Similarly
2nd element from List-->2nd element from array-->Result is false
3rd element from List-->3rd element from array-->Result is true
So at last false value is overriden by true & the result will be displayed as 'Right Order'
Thanks,
Rakesh
The code provided by you was very good.
But I have small problem with that.
Like you have mentioned,you assigned the items order in an string array & with each element in the list u r comparing with the 1st,2nd,3rd item in an array.
So assume that i compared the first element of the list with first element in an array.It matched and 'rightOrder' will be 'true'
Similarly
2nd element from List-->2nd element from array-->Result is false
3rd element from List-->3rd element from array-->Result is true
So at last false value is overriden by true & the result will be displayed as 'Right Order'
Thanks,
Rakesh
- artur_gadomski
- Posts: 207
- Joined: Mon Jul 19, 2010 6:55 am
- Location: Copenhagen, Denmark
- Contact:
Re: Verify order of elements
No it won't. Default value is true and it will be overwritten only if one of the values don't match. In your example it will be as follows:
start
right order = true
1st item (match) - no change to right order
2nd item (no match) - right order = false
3rd item (match) - no change to right order
at the end right order is false.
start
right order = true
1st item (match) - no change to right order
2nd item (no match) - right order = false
3rd item (match) - no change to right order
at the end right order is false.