Execution gets stuck - chromedriver and Katalon processes 0 task manager

Groovy code that you can use in Katalon Studio to forcefully kill any running ChromeDriver sessions after each test run on Windows:

groovy

// This will kill all chromedriver.exe processes forcefully
try {
    String[] cmd = ["taskkill", "/F", "/IM", "chromedriver.exe", "/T"]
    ProcessBuilder pb = new ProcessBuilder(cmd)
    pb.inheritIO() // Optional: allows you to see output/errors, may aid debugging
    Process process = pb.start()
    process.waitFor()
    process.destroy()
    println("chromedriver.exe processes terminated.")
} catch (Exception e) {
    println("Failed to kill chromedriver.exe: " + e.getMessage())
}
  • You can add this code in a Test Listener’s @AfterTestCase or @AfterTestSuite hook, or at the end of any test script to ensure complete cleanup.​
  • The /F flag forces termination, and /T kills child processes as well.

Note: This code only works on Windows, and will terminate all chromedriver.exe processes—ensure you don’t have other active sessions you want to keep. For macOS/Linux systems, replace the command with pkill chromedriver

You quoted the above code. It does not contain WebUI.openBrowser('') and WebUI.closeBrowser(). Therefore this code fragment seems to be incomplete. You must have something more, but you haven’t disclosed it to us.

Your test should explicitly open and close the browser. How do you do it in your test suite?

I don’t understand this. How do you configure the test suite to repeat the quoted Groovy script 30 times? Some screenshot might help to understand what you meant.