Return a list of the items in a windows combo box AutomationControl.

IList<string> GetComboBoxItems();



Return Value

A list of items in the combo box.


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



This topic was last updated on January 13, 2022, at 02:42:23 PM.

Eggplant icon | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant