Skip to main content


Returns a list of AutomationControls matching the supplied criteria.

IList<AutomationControl> FindControls(string wantedText);
IList<AutomationControl> FindControls(string wantedText, string wantedClass);
IList<AutomationControl> FindControls(string wantedText, TextMatch textMatch);
IList<ConAutomationControltrol> FindControls(string wantedText, string wantedClass, TextMatch textMatch);
IList<AutomationControl> FindControls(Predicate<Control> selectionFunction);


wantedText: The text of the AutomationControl. The default match criteria is contains, case insensitive. This value can be none or an empty string "" if you are only matching on wantedClass.

textMatch: Options are TextMatch.Contains (default), TextMatch.Exact, TextMatch.StartsWith, TextMatch.EndsWith, TextMatch.MatchCase See TextMatch.

wantedClass: The control class name.

selectionFunction: A reference to a user supplied selection function. See SelectionFunction.

Return Value

A list of AutomationControl objects that can be used to access the found items.


This methods does not wait. It will return an empty list if no matching items are found.


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