mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
修复new_tab()时浏览器关闭导致的卡住
This commit is contained in:
parent
bd79de1abd
commit
c6941438d5
@ -315,8 +315,12 @@ class Chromium(object):
|
|||||||
except CDPError:
|
except CDPError:
|
||||||
return _new_tab_by_js(self, url, obj, new_window)
|
return _new_tab_by_js(self, url, obj, new_window)
|
||||||
|
|
||||||
while tab not in self._drivers:
|
while self.states.is_alive:
|
||||||
|
if tab in self._drivers:
|
||||||
|
break
|
||||||
sleep(.1)
|
sleep(.1)
|
||||||
|
else:
|
||||||
|
raise BrowserConnectError('浏览器已关闭')
|
||||||
tab = obj(self, tab)
|
tab = obj(self, tab)
|
||||||
if url:
|
if url:
|
||||||
tab.get(url)
|
tab.get(url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user