修复wait.load_start()不能正确设置超时的问题

This commit is contained in:
g1879 2023-06-19 17:55:52 +08:00
parent 8b598bfad4
commit ca36271232
2 changed files with 14 additions and 4 deletions

View File

@ -577,9 +577,12 @@ class ChromiumBase(BasePage):
if ok:
try:
if single:
return make_chromium_ele(self, node_id=nodeIds['nodeIds'][0])
r = make_chromium_ele(self, node_id=nodeIds['nodeIds'][0])
break
else:
return [make_chromium_ele(self, node_id=i) for i in nodeIds['nodeIds']]
r = [make_chromium_ele(self, node_id=i) for i in nodeIds['nodeIds']]
break
except ElementLossError:
ok = False
@ -595,6 +598,12 @@ class ChromiumBase(BasePage):
sleep(.1)
try:
self.run_cdp('DOM.discardSearchResults', searchId=search_result['searchId'])
except:
pass
return r
def refresh(self, ignore_cache=False):
"""刷新当前页面
:param ignore_cache: 是否忽略缓存
@ -1062,7 +1071,8 @@ class ChromiumBaseWaiter(object):
:return: 是否等待成功
"""
if timeout != 0:
timeout = self._driver.timeout if timeout in (None, True) else timeout
if timeout is None or timeout is True:
timeout = self._driver.timeout
end_time = perf_counter() + timeout
while perf_counter() < end_time:
if self._driver.is_loading == start:

View File

@ -3,7 +3,6 @@
@Author : g1879
@Contact : g1879@qq.com
"""
from requests import Session
from .base import BasePage
@ -44,6 +43,7 @@ class WebPage(SessionPage, ChromiumPage, BasePage):
self._response = None
self._set = None
self._screencast = None
self._DownloadKit = None
self._set_start_options(driver_or_options, session_or_options)
self._set_runtime_settings()