Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes #93

skip closed browsers when setting Selenium timeout
  • Loading branch information...
commit 5c033cea15aa4f7056885839d78f9ade88fe6578 1 parent 966a4c5
Kevin Ormbrek ombre42 authored
2  src/Selenium2Library/keywords/_browsermanagement.py
View
@@ -342,7 +342,7 @@ def set_selenium_timeout(self, seconds):
"""
old_timeout = self.get_selenium_timeout()
self._timeout_in_secs = robot.utils.timestr_to_secs(seconds)
- for browser in self._cache.browsers:
+ for browser in self._cache.get_open_browsers():
browser.set_script_timeout(self._timeout_in_secs)
return old_timeout
16 test/unit/keywords/test_browsermanagement.py
View
@@ -1,6 +1,7 @@
import unittest
from Selenium2Library.keywords._browsermanagement import _BrowserManagementKeywords
from selenium import webdriver
+from mockito import *
class BrowserManagementTests(unittest.TestCase):
@@ -54,6 +55,21 @@ def test_create_remote_browser_with_desired_prefs(self):
self.verify_browser(webdriver.Remote, "chrome", remote="http://127.0.0.1/wd/hub",
desired_capabilities=expected_caps)
+ def test_set_selenium_timeout_only_affects_open_browsers(self):
+ bm = _BrowserManagementKeywords()
+ first_browser, second_browser = mock(), mock()
+ bm._cache.register(first_browser)
+ bm._cache.close()
+ verify(first_browser).quit()
+ bm._cache.register(second_browser)
+ bm.set_selenium_timeout("10 seconds")
+ verify(second_browser).set_script_timeout(10.0)
+ bm._cache.close_all()
+ verify(second_browser).quit()
+ bm.set_selenium_timeout("20 seconds")
+ verifyNoMoreInteractions(first_browser)
+ verifyNoMoreInteractions(second_browser)
+
def verify_browser(self , webdriver_type , browser_name, **kw):
#todo try lambda *x: was_called = true
Please sign in to comment.
Something went wrong with that request. Please try again.