0

I've run across an issue when running my Automation Tests. If i am debugging a test, it fails. If i after that stop the debugging, the browser is left open and the Chromedriver.exe task is left running in the background. its easy to close the chrome browser but the Chromedriver.exe is a bit more annoying as I could do a lot of debugging and have many of them left open. is there a correct way to close these in debugging and can I stop the test mid way? In my tests I use the

  public void Dispose()
    {
        _driver.Quit();
    }

and this works as long as I am not in debug mode and I stop the test in the middle. Any ideas on what should be the proper method to close these? Maybe a misunderstanding on my side to how im using Visual Studio. Any help is much appreciated.

Edit: Im not sure thats related. When in debug mode, if you are running an automation test and if it fails. If you then stop the test at the fail point it leaves the browser open and the chromedriver running. my question is,
Is there a correct way to exit debug mode that closes the left open processes and browser. or is this a manual process or something that you use to do this outside of Visual Studio?

Sam
  • 381
  • 3
  • 15
  • Possible duplicate of [Selenium : How to stop geckodriver process impacting PC memory, without calling driver.quit()?](https://stackoverflow.com/questions/47999568/selenium-how-to-stop-geckodriver-process-impacting-pc-memory-without-calling) – undetected Selenium Jan 17 '18 at 10:33

1 Answers1

0

I do the same thing all the time. The problem is that you are stopping the test mid-run. When you do this, you leave the browser open. There are a couple options.

  1. When you are done debugging, just hit Run. It will attempt to continue and fail and should close everything down properly.

  2. Keep using it the way you currently do. You can kill processes using Task Manager, as needed. I have considered writing a batch file that kills all the chromedriver.exe processes, etc. You could do that and have it target IE and FF also to make cleaning up a lot of them easier.

JeffC
  • 22,180
  • 5
  • 32
  • 55