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;
}
}