add param for Chrome.start

This commit is contained in:
Barbara Miller 2020-10-21 15:39:46 -07:00
parent f2ebdca597
commit 11c5cfa865

View File

@ -135,7 +135,7 @@ class Chrome:
return cookie_db return cookie_db
def start(self, proxy=None, cookie_db=None, disk_cache_dir=None, def start(self, proxy=None, cookie_db=None, disk_cache_dir=None,
disk_cache_size=None): disk_cache_size=None, websocket_timeout=60):
''' '''
Starts chrome/chromium process. Starts chrome/chromium process.
@ -149,6 +149,7 @@ class Chrome:
is inside `self._home_tmpdir` (default None). is inside `self._home_tmpdir` (default None).
disk_cache_size: Forces the maximum disk space to be used by the disk disk_cache_size: Forces the maximum disk space to be used by the disk
cache, in bytes. (default None) cache, in bytes. (default None)
websocket_timeout: websocket timeout, in seconds
Returns: Returns:
websocket url to chrome window with about:blank loaded websocket url to chrome window with about:blank loaded
''' '''
@ -200,7 +201,7 @@ class Chrome:
self._out_reader_thread.start() self._out_reader_thread.start()
self.logger.info('chrome running, pid %s' % self.chrome_process.pid) self.logger.info('chrome running, pid %s' % self.chrome_process.pid)
return self._websocket_url() return self._websocket_url(timeout_sec=websocket_timeout)
def _websocket_url(self, timeout_sec = 60): def _websocket_url(self, timeout_sec = 60):
json_url = 'http://localhost:%s/json' % self.port json_url = 'http://localhost:%s/json' % self.port