From 4fc89485b67cd012f875a4241b1cdc7a7f9fbbef Mon Sep 17 00:00:00 2001 From: d0ngw Date: Sun, 16 Feb 2014 22:04:12 +0800 Subject: [PATCH] Fix chrome driver can't quit --- .../webmagic/downloader/selenium/WebDriverPool.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webmagic-selenium/src/main/java/us/codecraft/webmagic/downloader/selenium/WebDriverPool.java b/webmagic-selenium/src/main/java/us/codecraft/webmagic/downloader/selenium/WebDriverPool.java index 71ba290e..98b93a9b 100644 --- a/webmagic-selenium/src/main/java/us/codecraft/webmagic/downloader/selenium/WebDriverPool.java +++ b/webmagic-selenium/src/main/java/us/codecraft/webmagic/downloader/selenium/WebDriverPool.java @@ -1,5 +1,6 @@ package us.codecraft.webmagic.downloader.selenium; +import org.apache.log4j.Logger; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; @@ -16,6 +17,7 @@ import java.util.concurrent.atomic.AtomicInteger; * Time: 下午1:41
*/ class WebDriverPool { + private Logger logger = Logger.getLogger(getClass()); private final static int DEFAULT_CAPACITY = 5; @@ -81,8 +83,8 @@ class WebDriverPool { throw new IllegalStateException("Already closed!"); } for (WebDriver webDriver : webDriverList) { - webDriver.close(); + logger.info("Quit webDriver" + webDriver); + webDriver.quit(); } - } }