mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
修复wait.load_start()不能正确设置超时的问题
This commit is contained in:
parent
8b598bfad4
commit
ca36271232
@ -577,9 +577,12 @@ class ChromiumBase(BasePage):
|
|||||||
if ok:
|
if ok:
|
||||||
try:
|
try:
|
||||||
if single:
|
if single:
|
||||||
return make_chromium_ele(self, node_id=nodeIds['nodeIds'][0])
|
r = make_chromium_ele(self, node_id=nodeIds['nodeIds'][0])
|
||||||
|
break
|
||||||
|
|
||||||
else:
|
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:
|
except ElementLossError:
|
||||||
ok = False
|
ok = False
|
||||||
@ -595,6 +598,12 @@ class ChromiumBase(BasePage):
|
|||||||
|
|
||||||
sleep(.1)
|
sleep(.1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.run_cdp('DOM.discardSearchResults', searchId=search_result['searchId'])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return r
|
||||||
|
|
||||||
def refresh(self, ignore_cache=False):
|
def refresh(self, ignore_cache=False):
|
||||||
"""刷新当前页面
|
"""刷新当前页面
|
||||||
:param ignore_cache: 是否忽略缓存
|
:param ignore_cache: 是否忽略缓存
|
||||||
@ -1062,7 +1071,8 @@ class ChromiumBaseWaiter(object):
|
|||||||
:return: 是否等待成功
|
:return: 是否等待成功
|
||||||
"""
|
"""
|
||||||
if timeout != 0:
|
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
|
end_time = perf_counter() + timeout
|
||||||
while perf_counter() < end_time:
|
while perf_counter() < end_time:
|
||||||
if self._driver.is_loading == start:
|
if self._driver.is_loading == start:
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
@Author : g1879
|
@Author : g1879
|
||||||
@Contact : g1879@qq.com
|
@Contact : g1879@qq.com
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from requests import Session
|
from requests import Session
|
||||||
|
|
||||||
from .base import BasePage
|
from .base import BasePage
|
||||||
@ -44,6 +43,7 @@ class WebPage(SessionPage, ChromiumPage, BasePage):
|
|||||||
self._response = None
|
self._response = None
|
||||||
self._set = None
|
self._set = None
|
||||||
self._screencast = None
|
self._screencast = None
|
||||||
|
self._DownloadKit = None
|
||||||
|
|
||||||
self._set_start_options(driver_or_options, session_or_options)
|
self._set_start_options(driver_or_options, session_or_options)
|
||||||
self._set_runtime_settings()
|
self._set_runtime_settings()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user