It appears to be possible for the debug port to open without any tabs, so we should handle that.

This commit is contained in:
Eldon 2014-01-22 02:38:51 +00:00
parent 428d6cb7da
commit 5a6749777b

View File

@ -18,6 +18,8 @@ class Umbra:
def get_websocket(self, on_open, url=None):
def fetch_debugging_json():
return loads(urllib.request.urlopen("http://localhost:%s/json" % self.chrome_debug_port).read().decode('utf-8').replace("\\n",""))
while len(fetch_debugging_json()) == 0:
time.sleep(0.5)
debug_info = fetch_debugging_json()
if url: #Polling for the data url we used to initialize the window
while not [x for x in debug_info if x['url'] == url]: