多くのchromedriver.exeがWindows上でぶら下がっている – Selenium
Selenium WebDriverは終了していますが、 “chromedriver.exe”プロセスはシステムに停止しています。図を参照してください:

問題
URLをロードして存在するシンプルなWebDriverの例であるコードがありますが、chromedriver.exeは決して殺されません。
LoadWebPageExample.java
package com.mkyong.test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
public class LoadWebPageExample {
public static void main(String[]args) {
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("window-size=800,600");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(capabilities);
driver.get("http://google.com/");
driver.close();
}
}
解決策
これは一般的な間違いで、解決するために `driver.quit()`を使って自動テストを終了します。
LoadWebPageExample.java
package com.mkyong.test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
public class LoadWebPageExample {
public static void main(String[]args) {
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("window-size=800,600");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(capabilities);
driver.get("http://google.com/");
//driver.close();
driver.quit();
}
}
参考文献
-
http://docs.seleniumhq.org/docs/03__webdriver.jsp
[Selenium – WebDriver
ドキュメンテーション]。
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.html
[Selenium
ChromeDriver]