Why And How Should We Terminate Browser Driver Executable File In Selenium WebDriver

Hello People,

Some days ago, I was running my regression automation suite and found webdriver is not able to launch browser. I was getting some socket exception. Whenever I face such situation, I just try to update browser version, browser driver version and selenium jar file version. Versioning non-compatibility is major issue in Selenium for not launching browser or URL.

When I downloaded “chromedriver.exe” and tried to replace with old one in folder. It was giving me exception that it can not be deleted as it is in use. But I was not running any scripts. I opened task manager and see there are so many instance which are up and running.

This is because we need to set a system property to launch any browser. Statement is as below:


Because of above statement, system launches new executable file for each program run keeping older executable files in memory. It can reduce your system performance drastically.

So, it is good idea to terminate the execution of executable files once you are done. Now we will see how can we do that. We need to use below statement to kill executable file:

Runtime.getRuntime().exec(“taskkill /F /IM chromedriver.exe”);

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning