Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill many geckodriver.exe processes?

I am using Windows 10 pro x64, Firefox 50.x, Java 8, Selenium 3.0.1

public RemoteWebDriver remoteWebDriver;

//...

System.setProperty("webdriver.gecko.driver", browserWebDriverFilePath);
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
remoteWebDriver = new FirefoxDriver(capabilities);
remoteWebDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
remoteWebDriver.manage().window().maximize();

//...

remoteWebDriver.quit();

enter image description here

like image 758
Do Nhu Vy Avatar asked Oct 25 '25 14:10

Do Nhu Vy


1 Answers

Run this from Command line:

taskkill /F /IM geckodriver.exe

Or better of, put it in a batch file and run the file every time you want to clean up.

You can also do it from your code if you want, before you start running:

boolean isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0;
try {
    if (isDebug)
        Runtime.getRuntime().exec("taskkill /F /IM geckodriver.exe");
} catch (IOException e) {
    e.printStackTrace();
}

Only in debug to avoid killing instances on slave if you're running in parallel.

like image 145
Moshisho Avatar answered Oct 27 '25 03:10

Moshisho



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!