specflow - Killing all iexplore processes after test run fails -


when run our codedui tests , test cases fail kill internet explorer process calling kill() below:

private static readonly hashset<string> processestokill =      new hashset<string>(new[] { "iexplore" });  public static void kill() {     var runningprocessestokill = (from p in process.getprocesses()         processestokill.contains(p.processname,              stringcomparer.ordinalignorecase)         select p).toarray();      // first try close process in friendly way     closeprocess(runningprocessestokill);      // wait while give processes time terminate     waitforprocess(runningprocessestokill);      // if not closed kill process.     killprocess(runningprocessestokill); } 

killing done calling closemainwindow() , close() on processes first, waiting while , calling kill() on processes.

unfortunately, not close javascript alert popup. when test run finished remains in screen blocking next test, so:

popup remains in screen

why not close alert, , how can fix this?

you can brute force using taskkill command command line:

c:\>taskkill /f /im iexplore.exe 

this, of course, doesn't tests. instead, use process.start(...):

public static void kill() {     system.diagnostics.process.start("taskkill", "/f /im iexplore.exe"); } 

this shut down internet explorer processes, regardless of whether or not have alert or confirm dialog visible.

references:


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -