Make Browser._wait_for sleep time a varible

Useful to be able to tweak this value in other apps using `Browser`.
This commit is contained in:
Vangelis Banos 2018-02-18 23:08:51 +00:00
parent 0d605d0a88
commit e2128b42f0

View File

@ -288,6 +288,7 @@ class Browser:
self.websock_thread = None self.websock_thread = None
self.is_browsing = False self.is_browsing = False
self._command_id = Counter() self._command_id = Counter()
self._wait_interval = 0.5
def __enter__(self): def __enter__(self):
self.start() self.start()
@ -309,7 +310,7 @@ class Browser:
raise BrowsingTimeout( raise BrowsingTimeout(
'timed out after %.1fs waiting for: %s' % ( 'timed out after %.1fs waiting for: %s' % (
elapsed, callback)) elapsed, callback))
brozzler.sleep(0.5) brozzler.sleep(self._wait_interval)
def send_to_chrome(self, suppress_logging=False, **kwargs): def send_to_chrome(self, suppress_logging=False, **kwargs):
msg_id = next(self._command_id) msg_id = next(self._command_id)