HTMLDialogs can't find dialogs that are opened from dialogs
Brought to you by:
jvmenen
If a HTML Dialog opens another dialog then WatiN doesn't find it.
This is because of a bug at line 46 of HTMLDialogCollection which restricts the dialogs to only be from the parent IE.
If the parent is another dialog then it fails
i.e.
var popups = windows.GetWindows(window => window.ParentHwnd == toplevelWindow.Hwnd && NativeMethods.CompareClassNames(window.Hwnd, "Internet Explorer_TridentDlgFrame"));
in
public HtmlDialogCollection(IntPtr hWnd, bool waitForComplete)
{
findBy = Find.Any;
this.waitForComplete = waitForComplete;
htmlDialogs = new List<HtmlDialog>();
var toplevelWindow = new Window(hWnd).ToplevelWindow; var windows = new WindowsEnumerator(); var popups = windows.GetWindows(window => window.ParentHwnd == toplevelWindow.Hwnd && NativeMethods.CompareClassNames(window.Hwnd, "Internet Explorer_TridentDlgFrame")); foreach (var window in popups) { var htmlDialog = new HtmlDialog(window.Hwnd); htmlDialogs.Add(htmlDialog); }
}
It should also check to seen if any of the parentHwnd or it's parents are equal to the toplevelWindow.Hwnd
Thanks for the report. The issue is fixed and will be part of the next release.