Completed
Last Updated: 15 Aug 2013 14:42 by ADMIN
ADMIN
Cody
Created on: 01 Aug 2013 18:34
Type: Bug Report
1
KillBrowserProcessOnClose does not close popup dialogs
If during the running of a test the browser opens up a popup dialog, e.g. a JavaScript confirm dialog, and then the test fails while this dialog is open, even if you turn on KillBrowserProcessOnClose the dialog will be left behind.

As a temporary workaround you can add this code to your test:

public override void OnAfterTestCompleted(TestResult result)
{
    switch (Manager.Settings.Web.DefaultBrowser)
    {
        case BrowserType.InternetExplorer:
            try
            {
                foreach (Process proc in Process.GetProcessesByName("iexplore"))
                {
                    proc.Kill();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            break;

        case BrowserType.FireFox:
            try
            {
                foreach (Process proc in Process.GetProcessesByName("firefox"))
                {
                    proc.Kill();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            break;

        case BrowserType.Chrome:
            try
            {
                foreach (Process proc in Process.GetProcessesByName("chrome"))
                {
                    proc.Kill();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            break;

        case BrowserType.Safari:
            try
            {
                foreach (Process proc in Process.GetProcessesByName("safari"))
                {
                    proc.Kill();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            break;
    }
}
1 comment
ADMIN
Pavel
Posted on: 15 Aug 2013 14:42
This is not a valid case - UnexpectedDialogAction  setting is set to DoNotHandle and this is the reason the dialog remains.