Selenium WebDriver RuntimeException:Process refused to die after 10 seconds, and couldn't taskkill it: Unable to find executable for: taskkill

taskkill is a standard Windows utility. The fact that Selenium cannot find it means that the environment variable PATH does not include the directory that contains standard system utilities. It is C:\Windows\system32 for modern Windows versions.

Add this directory to the PATH variable (follow this instruction to modify the PATH variable: http://www.computerhope.com/issues/ch000549.htm) and restart the console or IDE where you run Selenium scripts to apply this environment change.

lordyoum

driver.quit(); causes the problem. If you use driver.close(); this exception will not be thrown, and the browser will be closed properly.

Del Patel

I had the same runTimeException, running webdriver on IE 11 and using TestNG.

As a workaround I used a try catch in the @AfterSuite and killed the background process :

public void closeBrowser()
{
    try 
    {
        driver.close();
        Runtime.getRuntime().exec("taskkill /F /IM IEDriverServer.exe");

    }
    catch (Exception anException) 
    {
        anException.printStackTrace();
    }
}

Works as expected so far...

Adding to @Alexei answer, as the path C:\Windows\system32 is already added to Windows Path, restarting my eclipse with Admin privileges worked for me in Windows 10 OS.

this quit() problem only on MS IE. my workaround with IEDriver.exe and selenium remotewebdriver is:

quit() //close tested window

quit() //quit ie browser