mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
微调
This commit is contained in:
parent
982dee6246
commit
0c1fc25faf
@ -168,7 +168,7 @@ class ChromiumBase(BasePage):
|
|||||||
result = False
|
result = False
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
r = self._run_cdp('Page.getFrameTree')
|
r = self._run_cdp('Page.getFrameTree', _ignore=PageDisconnectedError)
|
||||||
for i in findall(r"'id': '(.*?)'", str(r)):
|
for i in findall(r"'id': '(.*?)'", str(r)):
|
||||||
self.browser._frames[i] = self.tab_id
|
self.browser._frames[i] = self.tab_id
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class ChromiumFrame(ChromiumBase):
|
|||||||
|
|
||||||
self._root_id = self.doc_ele._obj_id
|
self._root_id = self.doc_ele._obj_id
|
||||||
|
|
||||||
r = self._run_cdp('Page.getFrameTree')
|
r = self._run_cdp('Page.getFrameTree', _ignore=PageDisconnectedError)
|
||||||
for i in findall(r"'id': '(.*?)'", str(r)):
|
for i in findall(r"'id': '(.*?)'", str(r)):
|
||||||
self.browser._frames[i] = self.tab_id
|
self.browser._frames[i] = self.tab_id
|
||||||
return True
|
return True
|
||||||
|
@ -60,7 +60,7 @@ class BrowserWaiter(OriginWaiter):
|
|||||||
:return: 成功返回任务对象,失败返回False
|
:return: 成功返回任务对象,失败返回False
|
||||||
"""
|
"""
|
||||||
if not self._owner._dl_mgr._running:
|
if not self._owner._dl_mgr._running:
|
||||||
raise RuntimeError('此功能需显式设置下载路径(使用set.download_path()方法、配置对象或ini文件均可)。')
|
raise RuntimeError('此功能需显式设置下载路径才能使用。使用set.download_path()方法、配置对象或ini文件均可。')
|
||||||
self._owner._dl_mgr.set_flag('browser', False if cancel_it else True)
|
self._owner._dl_mgr.set_flag('browser', False if cancel_it else True)
|
||||||
if timeout is None:
|
if timeout is None:
|
||||||
timeout = self._owner.timeout
|
timeout = self._owner.timeout
|
||||||
@ -130,7 +130,7 @@ class BaseWaiter(OriginWaiter):
|
|||||||
end_time = perf_counter() + timeout
|
end_time = perf_counter() + timeout
|
||||||
ele = self._owner._ele(loc_or_ele, raise_err=False, timeout=timeout)
|
ele = self._owner._ele(loc_or_ele, raise_err=False, timeout=timeout)
|
||||||
timeout = end_time - perf_counter()
|
timeout = end_time - perf_counter()
|
||||||
if timeout <= 0:
|
if not ele:
|
||||||
if raise_err is True or Settings.raise_when_wait_failed is True:
|
if raise_err is True or Settings.raise_when_wait_failed is True:
|
||||||
raise WaitTimeoutError(f'等待元素显示失败(等待{timeout}秒)。')
|
raise WaitTimeoutError(f'等待元素显示失败(等待{timeout}秒)。')
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user