public DialogWatcher(Browser browser) { this.browser = browser; FoundDialog = false; InitializeDialogWatcher(); Start(); }
public void SetCurrentWindowHandleExceptionTest() { _browser = new InternetExplorer(); string fakeWindowTitle = "Window does not exist"; Assert.AreEqual(_browser.GetCurrentWindowHandle(), IntPtr.Zero); try { _browser.SetCurrentWindowHandle(fakeWindowTitle); } catch (Exception e) { Assert.AreEqual(e.Message, string.Format("FATAL ERROR: Unable to aquire window handle for window title {0}.", fakeWindowTitle)); } }
public void SetCurrentWindowHandleTest() { _browser = new InternetExplorer(); Process proc = new Process(); proc.StartInfo.FileName = "notepad.exe"; proc.Start(); proc.WaitForInputIdle(4000); IntPtr windowHandle = proc.MainWindowHandle; string windowName = proc.MainWindowTitle; if (windowHandle.ToInt32() == 0) Assert.Fail("Notepad process failed to start within allotted time."); _browser.SetCurrentWindowHandle(windowName); Assert.AreEqual(_browser.GetCurrentWindowHandle(), windowHandle); proc.Kill(); }