how to get Childrens from div?

May 10, 2011 at 6:15 AM


I need to do automation of Search functionality. for example It has all the dynamic search results.

I need all these dynamic values from UI like Car Name, Its Price, TYpe(Old/New) based on quuery and compare them with the DB.

So, My basic need is, If I initialize any Div with its id attribute, So, Will i be able to get its Child elements?

Also, I couldn't find any generic class like UIElement, which can take the any element's properties, Method.

Can somebody help me in getting child/related elements?

May 10, 2011 at 7:15 AM

Try the below approach.

UITestControlCollection col = pgObject.divObject.UnWrap().GetChildren();

And then iterate thru the collection to see if you reach to the Car Name, Price, Type etc. by looking for the pattern.

I would suggest you to write a reusable method which will return all (or matching car objects based on a search criteria) Car objects (write a Car class which has Name, Price, Type etc. as fields) as a collection. This approach is readable and maintainable.

Let me know if you need some more help.

Thanks again for using CUITe!

May 13, 2011 at 5:46 AM

Hey sureba,

Thanks you so much, It worked for me by using the above method.

Do we have any generic Class like UIElement in CUITe?

because many times it requires to intialize object of such generic class to get any unidetified control.


May 16, 2011 at 7:58 AM

As of now, I have not included any Generic/Custom element classes for CUITe.

Can you give me more details when and where do you require it? I can add support if your requirement is generic enough.

Even otherwise you can use HtmlCustom directly.

May 17, 2011 at 9:28 AM

Hey sureba,

When I am doing GetChildern(), I get so many elements.

But this method returns me UITestControlCollection and I am not able to use Click, Focus etc. methods directly on It.

So, I had to use Mouse.Click(UITestControl, Pixel value);

To remove such overhead I want like this method should return any generic control collection which have all the supportive method, like click etc.

May 17, 2011 at 11:24 AM

Oh ok, now I understand your requirement better.

Please log this requirement in the IssueTracker, will work on it as and when I get time. Can't give you an ETA now, busy with so many things.