diff --git a/DrissionPage/chromium_base.py b/DrissionPage/chromium_base.py index f05e1cd..fff64ab 100644 --- a/DrissionPage/chromium_base.py +++ b/DrissionPage/chromium_base.py @@ -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: diff --git a/DrissionPage/web_page.py b/DrissionPage/web_page.py index dbdc5db..55b44bf 100644 --- a/DrissionPage/web_page.py +++ b/DrissionPage/web_page.py @@ -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()