WaitForTopWindowCount
Waits until a number of top-level windows match the given criteria.
void WaitForTopWindowCount(string wantedText, int count);
void WaitForTopWindowCount(string wantedText, int count, int maxWait);
void WaitForTopWindowCount(string wantedText, TextMatch textMatch, int count);
void WaitForTopWindowCount(string wantedText, TextMatch textMatch, int count, int maxWait);
void WaitForTopWindowCount(string wantedText, string wantedClass, int count);
void WaitForTopWindowCount(string wantedText, string wantedClass, int count, int maxWait);
void WaitForTopWindowCount(string wantedText, string wantedClass, TextMatch textMatch, int count);
void WaitForTopWindowCount(string wantedText, string wantedClass, TextMatch textMatch, int count, int maxWait);
void WaitForTopWindowCount(Predicate<Control> selectionFunction, int count);
void WaitForTopWindowCount(Predicate<Control> selectionFunction, int count, int maxWait);
Parameters
count:
The number of windows to match.
maxWait:
The maximum time in milliseconds to wait for the windows to reach the count specified. The default value is 120,000 milliseconds (2 minutes).
wantedText:
The text caption of the Controls. 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 to wait for.
selectionFunction:
A reference to a user supplied selection function. See SelectionFunction.
Return Value
None
Remarks
Where there can be multiple windows with the same text and class, and the number changes as a result of an action, this call will wait until the number of matching top level windows equals the given count.
Example
WaitForTopWindowCount("Untitled - Notepad", 2); // wait for two instances of windows with the given title to appear before continuing
Related: