Permalink
Browse files

Merge pull request #263 from emanlove/master

Register browser even if get url fails.
  • Loading branch information...
2 parents f775cd9 + 9e16282 commit bad7fa8244e65bfba83b610fe32f384f43262373 @ombre42 ombre42 committed Jan 24, 2014
Showing with 18 additions and 1 deletion.
  1. +7 −1 src/Selenium2Library/keywords/_browsermanagement.py
  2. +11 −0 test/acceptance/open_and_close.txt
@@ -111,7 +111,13 @@ 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)
+ self._debug("Opened browser with session id %s but failed to open url '%s'"
+ % (browser.session_id, url))
+ raise
self._debug('Opened browser with session id %s'
% browser.session_id)
return self._cache.register(browser, alias)
@@ -17,3 +17,14 @@ There Should Be A Good Error Message If Browser Is Not Opened
Close Browser Does Nothing When No Browser Is Opened
Close Browser
+
+Browser Open With Not Well-Formed URL Should Close
+ [Documentation] Verify after incomplete 'Open Browser' browser closes
+ ... LOG 1.1:10 DEBUG STARTS: Opened browser with session id
+ ... LOG 1.1:10 DEBUG REGEXP: .*but failed to open url.*
+ ... LOG 2:2 DEBUG STARTS: DELETE
+ ... LOG 2:3 DEBUG Finished Request
+
+ Run Keyword And Expect Error *
+ ... Open Browser bad.url.bad ${BROWSER}
+ Close All Browsers

0 comments on commit bad7fa8

Please sign in to comment.