release Selenium chromedriver.exe from memory release Selenium chromedriver.exe from memory selenium selenium

release Selenium chromedriver.exe from memory


per the Selenium API, you really should call browser.quit() as this method will close all windows and kills the process. You should still use browser.quit().

However: At my workplace, we've noticed a huge problem when trying to execute chromedriver tests in the Java platform, where the chromedriver.exe actually still exists even after using browser.quit(). To counter this, we created a batch file similar to this one below, that just forces closed the processes.

kill_chromedriver.bat

@echo offrem   just kills stray local chromedriver.exe instances.rem   useful if you are trying to clean your project, and your ide is complaining.taskkill /im chromedriver.exe /f

Since chromedriver.exe is not a huge program and does not consume much memory, you shouldn't have to run this every time, but only when it presents a problem. For example when running Project->Clean in Eclipse.


browser.close() will close only the current chrome window.

browser.quit() should close all of the open windows, then exit webdriver.


Theoretically, calling browser.Quit will close all browser tabs and kill the process.

However, in my case I was not able to do that - since I running multiple tests in parallel, I didn't wanted to one test to close windows to others. Therefore, when my tests finish running, there are still many "chromedriver.exe" processes left running.

In order to overcome that, I wrote a simple cleanup code (C#):

Process[] chromeDriverProcesses =  Process.GetProcessesByName("chromedriver");foreach(var chromeDriverProcess in chromeDriverProcesses){    chromeDriverProcess.Kill();}