Skip to content

Commit

Permalink
* Added try/catch to driver.quit to avoid test failures due to race c…
Browse files Browse the repository at this point in the history
…ondition (until cause can be determined.)
  • Loading branch information
yurodivuie committed Mar 9, 2012
1 parent 1bf2785 commit d48be61
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/java/com/dynacrongroup/webtest/WebDriverLeakCheck.java
@@ -1,14 +1,15 @@
package com.dynacrongroup.webtest;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This class keeps track of the allocated WebDriver instances. It is used to
* help "garbage collect" the instances after use. This is particularly of
Expand Down Expand Up @@ -55,7 +56,12 @@ public static void add(@SuppressWarnings("rawtypes") Class clazz,
}

public static void remove(WebDriver s) {
s.quit();
try {
s.quit();
}
catch (WebDriverException e) {
log.warn(e.getMessage());
}
trackedWebDriver.remove(s);
log.trace("WebDriver shut down. " + WebDriverLeakCheck.open()
+ " still running.");
Expand Down

0 comments on commit d48be61

Please sign in to comment.