From 354bfef0c581795b0bb44f10f8451eaac91d739f Mon Sep 17 00:00:00 2001 From: adwu73 Date: Thu, 20 Sep 2012 07:50:49 +0800 Subject: [PATCH] browser cache reliability fix there are cases when browser.quit will throw exceptions, then browser cache will not be cleaned,and all future close_all will fail for same reason --- src/Selenium2Library/utils/browsercache.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Selenium2Library/utils/browsercache.py b/src/Selenium2Library/utils/browsercache.py index f05f2f055..c2b6db7f7 100644 --- a/src/Selenium2Library/utils/browsercache.py +++ b/src/Selenium2Library/utils/browsercache.py @@ -26,8 +26,10 @@ def close(self): self._closed.add(browser) def close_all(self): - for browser in self._connections: - if browser not in self._closed: - browser.quit() - self.empty_cache() + try: + for browser in self._connections: + if browser not in self._closed: + browser.quit() + finally: + self.empty_cache() return self.current