This is a migrated thread and some comments may be shown as answers.
WebAii UI testingfreamework - How test in a correct way composite user control
1 Answer 27 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Rolando asked on 12 Dec 2011, 03:51 AM
I am doing research about how to test our silverlight app in a correct way, and one question what I would like know is how we should test composite control (for example MyInventoryView.xaml is a view wich  contain a list of itemView.xaml using a ListBox)
something like:
                        <xyz:ItemView  ...  />

How I should get a list of these itemView objects?

The easy way to get a control when we know the name and the type is 

But what is the way to get when we are talking about specific usercontrol? (shall we add a reference from the project wich has the specific usercontrol??)

Best Regards,

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 16 Dec 2011, 01:56 PM
Hi Rolando,
I'm not sure I correctly understand you question?

You want to get all the ListBoxItems from a ListBox control? Here's a code sample that does that for the ListBox found this demo page:

Manager.Settings.Web.EnableSilverlight = true;
    //Settings.Current.Web.EnableSilverlight = True
    // Launch a browser instance
    // The active browser
    SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
    ListBox lb = app.Find.ByAutomationId<ListBox>("cityList");
    int counter=1;
    foreach (ListBoxItem lbi in lb.Find.AllByType<ListBoxItem>())
        Log.WriteLine("ListBoxItem " + counter.ToString() +":"+ lbi.Text);

This code will write the text of each ListBoxItem to the test log.

the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question