How to Kill IEDriver exe process running in background (Selenium webdriver)?

user1254261 picture user1254261 · Mar 26, 2014 · Viewed 27.3k times · Source

I'm using selenium webdriver(for Internet Explorer). What it does it basically opens a webpage in internet explorer and does form submitting.

How can I kill internetexplorer.exe running in background Automatically ?

Answer

Sighil picture Sighil · Mar 26, 2014

You can add the following code at the end of your test script to close the IE Driver. So there is no need of closing it manually.

try {
    Runtime.getRuntime().exec("taskkill /F /IM IEDriverServer.exe");
} catch (IOException e) {
    e.printStackTrace();
}

Else open notepad and paste the following code.

taskkill /F /IM IEDriverServer.exe

Save the file as closedriver.bat

Click on this batch file when u want to close the IE Driver.