GetComboBoxItems
Return a list of the items in a windows combo box AutomationControl.
IList<string> GetComboBoxItems();
Parameters
None
Return Value
A list of items in the combo box.
Example
AutomationControl notepadWindow = FindTopAutomationWindow("Untitled - Notepad"); //this will find top window with the indicated caption
notepadWindow.ActivateMenuItem("File", "Page Setup..."); //activates menu item with indicated ClassName and Text
AutomationControl setupDialog = notepadWindow.FindControl("Page Setup", "#32770"); //this will find "Page Setup" control dialog
IList<AutomationControl> comboBoxes = setupDialog.FindControls(null, "ComboBox");//this will find all ComboBoxes controls and will hold them in array list
IList<string> comboBoxItems = comboBoxes[0].GetComboBoxItems(); //this will hold all items from the first comboBox in the setupDialog
foreach(string item in comboBoxItems)
{
WriteMessage("item=" + item); //prints out all comboBox items to VU Event Log
}
comboBoxes[0].SelectComboBoxItem("A4"); // select the combo box item A4
Related: