WatiN and .net winforms WebBrowser control – is DialogWatcher possible?-Collection of common programming errors
Our target is: Watin-enabled browser testing embedded in a .net winform.
Currently, we are using a .net WebBrowser control to embed browser behavior in a winform. We are attaching WatiN to the WebBroswer control on the form with code like this ( thanks prostynick ):
var thread = new Thread(() =>
{
Settings.AutoStartDialogWatcher = false;
var ie = new IE(webBrowser1.ActiveXInstance);
ie.GoTo("http://www.google.com");
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
The problem is this – the “winform browser” needs to handle popups during testing/automation.
Question: How can popups be handled when Watin is attached to a winforms webBrowser control ( and not using its own WatiN-generated IE window )? a) Can Watin’s DialogWatcher still be used? If so …how?
b) If not, then perhaps we can write our own DialogWatcher — but we would need an hWnd or processID to add it. Where would we get correct hWnd or processId in this scenario where Waitin does not have its own window or process?
Thanks in advance for any ideas …alternate approaches that reach the same target are welcome!