# Using CloseBroswer(), it only close browser but Still chromeDriver is not killed. How to killed Chrome driver

**URL:** <https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090>\
**Category:** Web Testing\
**Tags:** chrome, web-testing, katalon-studio\
**Created:** [May 6, 2017, 3:12pm UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090 "2017-05-06T15:12:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ajay\_Gupta](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@Ajay\_Gupta](https://forum.katalon.com/u/Ajay_Gupta)\
**Post date:** [May 6, 2017, 3:12pm UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/1 "2017-05-06T15:12:50Z")

</div>

On using WebUI.closeBroswer(),

It only close browser, but chromeDriver,exe is still running on my machine. how to exit the chromeDriver.exe

&nbsp;

---

<div class="post-metadata">

**Author:** ![Zarashima](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/zarashima/32/928_2.png) [@Zarashima](https://forum.katalon.com/u/Zarashima)\
**Post date:** [May 6, 2017, 4:03pm UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/2 "2017-05-06T16:03:15Z")

</div>

Hi there,

My chromedriver.exe is terminated when I call ‘Close Browser’ step. Please double check again if your browser is closed completely or not, or there are multiple chromedriver instances on your side

If you want to terminate chromedriver.exe anytime after execution, you can check on ‘Terminate Drivers’ option from **Project -\> Settings -\> Execution**

Thanks

Edited: @Russ_Thomas

---

<div class="post-metadata">

**Author:** ![Eric\_Constantineau](https://avatars.discourse-cdn.com/v4/letter/e/b2d939/32.png) [@Eric\_Constantineau](https://forum.katalon.com/u/Eric_Constantineau)\
**Post date:** [February 13, 2018, 4:28pm UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/3 "2018-02-13T16:28:26Z")

</div>

Same here, after running many testcases, I have a large numbers of chromedrivers.exe still running. I use WebUI.closeBrowser() and it does close the browser, but let the driver run.

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [February 22, 2018, 4:38pm UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/4 "2018-02-22T16:38:16Z")

</div>

Manual work-around:  
Create a batch file with the following contents:

taskkill /f /im chromedriver.exe

pause

---

<div class="post-metadata">

**Author:** ![Yadav](https://avatars.discourse-cdn.com/v4/letter/y/e9a140/32.png) [@Yadav](https://forum.katalon.com/u/Yadav)\
**Post date:** [June 20, 2018, 11:28am UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/5 "2018-06-20T11:28:30Z")

</div>

Create a custom keyword as below and call it either at end or at the beginning of the test case.  
This will kill all instances of chrome.exe and chrome driver.exe

public class killProcess{

@Keyword

def killProcess() {  
Runtime.getRuntime().exec(“taskkill /im chromedriver.exe /f”)  
Runtime.getRuntime().exec(“taskkill /im chrome.exe /f”)  
}  
}

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [December 10, 2018, 9:28pm UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/6 "2018-12-10T21:28:34Z")

</div>

> [@Yadav](#):
>
> public class killProcess{
> 
> @Keyword
> 
> def killProcess() {  
> Runtime.getRuntime().exec(“taskkill /im chromedriver.exe /f”)  
> Runtime.getRuntime().exec(“taskkill /im chrome.exe /f”)  
> }  
> }

Getting errors when using this Keyword.  
Which imports / includes need to be added?

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [December 10, 2018, 10:01pm UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/7 "2018-12-10T22:01:21Z")

</div>

Personally, I prefer to keep this kind of thing out of my tests. I have a batch script which I run when needed. It contains just three lines, one for each webdriver module:

```
taskkill /f /im geckodriver.exe
taskkill /f /im chromedriver.exe
taskkill /f /im IEDriverServer.exe
```

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [December 11, 2018, 2:39am UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/8 "2018-12-11T02:39:11Z")

</div>

Hi Russ,

Thanks for your feed-back.

I use a similar batch script as well. I don’t always remember to run the script so I was thinking it might be good to add a keyword to kill the driver(s) when I call my single logoff case.

Also I use Windows Scheduler to run cases over-night so having the killProcess will help for that testing.

Cheers,  
Dave

**Found the solution (I had to use single quotes):**

public class killProcess {  
@Keyword  
def KILLWebdriver() {  
Runtime.getRuntime().exec(‘taskkill /f /im chrome.exe’)  
Runtime.getRuntime().exec(‘taskkill /f /im chromedriver.exe’)  
Runtime.getRuntime().exec(‘taskkill /f /im geckodriver.exe’)  
Runtime.getRuntime().exec(‘taskkill /f /im IEDriverServer.exe’)  
Runtime.getRuntime().exec(‘taskkill /f /im firefox.exe’)  
}  
}

---

<div class="post-metadata">

**Author:** ![devalex88](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/devalex88/32/336_2.png) [@devalex88](https://forum.katalon.com/u/devalex88)\
**Post date:** [August 27, 2019, 3:08am UTC](https://forum.katalon.com/t/using-closebroswer-it-only-close-browser-but-still-chromedriver-is-not-killed-how-to-killed-chrome-driver/6090/12 "2019-08-27T03:08:55Z")

</div>

Closed on August 27, 2019, 3:08am UTC


