Getting List/Collection of the same type of control

Nov 23, 2012 at 4:28 PM


Is there anything internally where I can get a collection of the element that i'm looking for. I have a few scenarios where I expect there to be more than one element on the page with the same ID as the scenario expects this to happen.

In this case, I expect multiple dropdowns. I'd like to add each dropdown that it finds matching the search criteria (each dropdown will have the same ID) to a List so I can iterate against the list to perform my actions.


Nov 23, 2012 at 4:59 PM

I think I found part of the solution/workaround. I can call on my CUITe element:


But I don't know how to convert the collection of UITestControls back to CUITe_HtmlComboBox objects so I can action against them.

Jan 17, 2013 at 8:24 AM

Hi ddoorn,

See this work item:

CUITe v1.5 already includes a GetChildren() method that can be used to retrieve a specific child control by its index.


Sample_CUITeTestProject\HtmlControlTests.cs also has sample code to convert an HtmlEdit control to a CUITe_HtmlEdit control as follows:

public void HtmlEdit_Wrap_Succeeds()
    GoogleHomePage pgGHomePage = CUITe_BrowserWindow.Launch<GoogleHomePage>("");
    HtmlEdit tmp = new HtmlEdit(pgGHomePage);
    tmp.SearchProperties.Add("Id", "lst-ib");

    CUITe_HtmlEdit txtEdit = new CUITe_HtmlEdit();
    txtEdit.SetText("Coded UI Test enhanced Framework");
    GoogleSearch pgSearch = CUITe_BrowserWindow.GetBrowserWindow<GoogleSearch>();