Permalink
Browse files

Register browser even if get url fails.

An issue was reported with SeleniumLibrary [1] where if "Open Browser"
succeeds in starting the browser but the get url call fails the opened
browser doesn't get registered with the Library's internal browser registery.
Thus when 'Close All Browsers' is called it fails to close the opened browser.
This patch fixes that problem.

[1] http://code.google.com/p/robotframework-seleniumlibrary/issues/detail?id=220
  • Loading branch information...
1 parent 264fda7 commit 7ad56e9463a00e7f6dab9432dce66930dc1409bd @emanlove emanlove committed Jan 2, 2014
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/Selenium2Library/keywords/_browsermanagement.py
View
6 src/Selenium2Library/keywords/_browsermanagement.py
@@ -111,7 +111,11 @@ def open_browser(self, url, browser='firefox', alias=None,remote_url=False,
self._info("Opening browser '%s' to base url '%s'" % (browser, url))
browser_name = browser
browser = self._make_browser(browser_name,desired_capabilities,ff_profile_dir,remote_url)
- browser.get(url)
+ try:
+ browser.get(url)
+ except:
+ self._cache.register(browser, alias)
+ raise
self._debug('Opened browser with session id %s'
% browser.session_id)
return self._cache.register(browser, alias)

0 comments on commit 7ad56e9

Please sign in to comment.