add comments for selenium driver

pull/17/head
yihua.huang 12 years ago
parent e87aabf8fd
commit aa9bee7b1b

@ -82,7 +82,6 @@ public class SeleniumDownloader implements Downloader, Destroyable {
} }
WebElement webElement = webDriver.findElement(By.xpath("/html")); WebElement webElement = webDriver.findElement(By.xpath("/html"));
String content = webElement.getAttribute("outerHTML"); String content = webElement.getAttribute("outerHTML");
//
Page page = new Page(); Page page = new Page();
page.setHtml(new Html(UrlUtils.fixAllRelativeHrefs(content, request.getUrl()))); page.setHtml(new Html(UrlUtils.fixAllRelativeHrefs(content, request.getUrl())));
page.setUrl(new PlainText(request.getUrl())); page.setUrl(new PlainText(request.getUrl()));

@ -27,8 +27,16 @@ class WebDriverPool {
private AtomicInteger stat = new AtomicInteger(STAT_RUNNING); private AtomicInteger stat = new AtomicInteger(STAT_RUNNING);
/**
* store webDrivers created
*/
private List<WebDriver> webDriverList = Collections.synchronizedList(new ArrayList<WebDriver>()); private List<WebDriver> webDriverList = Collections.synchronizedList(new ArrayList<WebDriver>());
/**
* store webDrivers available
*/
private BlockingDeque<WebDriver> innerQueue = new LinkedBlockingDeque<WebDriver>();
public WebDriverPool(int capacity) { public WebDriverPool(int capacity) {
this.capacity = capacity; this.capacity = capacity;
} }
@ -37,8 +45,6 @@ class WebDriverPool {
this(DEFAULT_CAPACITY); this(DEFAULT_CAPACITY);
} }
private BlockingDeque<WebDriver> innerQueue = new LinkedBlockingDeque<WebDriver>();
public WebDriver get() throws InterruptedException { public WebDriver get() throws InterruptedException {
checkRunning(); checkRunning();
WebDriver poll = innerQueue.poll(); WebDriver poll = innerQueue.poll();

Loading…
Cancel
Save