1
votes

I know that to properly close the selenium chromedriver I need to use driver.quit() My issue is when I'm creating tests through debug mode, I stop the tests quite a bit halfway through execution using breakpoints. I then fix whatever I need to and stop debugging so I can rerun the test which leaves chromedriver.exe running.

Is there a way to automate shutting this driver down before running tests? I have tried to put it before the piece of code that starts up the browser but I get this error:

Error   11  Could not copy "C:\LocalWork\eCommerce\QAAutomation\UIAutomation\Branches\MealCustomization\packages\Selenium.WebDriver.ChromeDriver.2.19.0.0\driver\chromedriver.exe" to "bin\Debug\chromedriver.exe". Exceeded retry count of 10. Failed. OnlineOrder.UITests

Has anybody figured out how to automate shutting this down prior to running tests?

1

1 Answers

5
votes

If you are using Visual Studio, you can add a command to kill process in Pre-Build Event.

taskkill /f /fi "pid gt 0" /im chromedriver.exe

Project Properties > Build Events