FindControls
Returns a list of Controls matching the supplied criteria.
IList<Control> FindControls(string wantedText);
IList<Control> FindControls(string wantedText, string wantedClass);
IList<Control> FindControls(string wantedText, TextMatch textMatch);
IList<Control> FindControls(string wantedText, string wantedClass, TextMatch textMatch);
IList<Control> FindControls(Predicate<Control> selectionFunction);
Parameters
wantedText:
The text of the Control. 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 window class name.
selectionFunction:
A reference to a user supplied selection function. See SelectionFunction.
Return Value
A list of Control objects that can be used to access the found items.
Remarks
This methods does not wait. It will return an empty list if no controls are found.
Example
Control setupDialog = FindTopWindow("Page Setup", "#32770");
IList<Control> comboBoxes = setupDialog.FindControls(null, "ComboBox");
IList<string> comboBoxItems = comboBoxes[0].GetComboBoxItems(); //get the items in the first combobox
Related: