public void CloseBrowser() { if (ie == null) { return; } ie.Close(); ie = null; if (IE.InternetExplorers().Count == 0) { return; } foreach (var explorer in IE.InternetExplorersNoWait()) { Console.WriteLine(explorer.Title + " (" + explorer.Url + ")"); explorer.Close(); } throw new Exception("Expected no open IE instances."); }
public static void BeforeTestRun() { StartWebHost(42000, Path.GetFullPath(@"..\..\..\..\Conference\Conference.Web")); StartWebHost(43000, Path.GetFullPath(@"..\..\..\..\Conference\Conference.Web.Public")); // Check if the WorkerRoleCommandProcessor is running var start = new ProcessStartInfo { FileName = Path.GetFullPath(@"..\..\..\..\WorkerRoleCommandProcessor\bin\Debug\CommandProcessor.exe"), WindowStyle = ProcessWindowStyle.Normal, UseShellExecute = false, }; // May be used to control browser visibility // instead of setting Visible = true on each instance creation. //Settings.Instance.MakeNewIeInstanceVisible = true; // Close all running IE instances while (IE.InternetExplorersNoWait().Count > 0) { var ie = IE.InternetExplorersNoWait()[0]; ie.ForceClose(); } // Check if the WorkerRoleCommandProcessor is running if (Process.GetProcessesByName(Path.GetFileNameWithoutExtension(start.FileName)).Any()) { return; } // Start in a new thread to dec Process.Start(Path.GetFullPath(@"..\..\..\..\WorkerRoleCommandProcessor\bin\Debug\CommandProcessor.exe")); // Wait for processor initialization and warm up Thread.Sleep(Constants.CommandProcessorWaitTimeout); }