From 415747731c2fd55028d19a75d436bc83e277874c Mon Sep 17 00:00:00 2001 From: g1879 Date: Tue, 2 Apr 2024 15:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/_functions/web.py | 6 +++--- DrissionPage/_units/listener.py | 2 +- README.en.md | 2 +- README.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DrissionPage/_functions/web.py b/DrissionPage/_functions/web.py index 341e14e..95d2209 100644 --- a/DrissionPage/_functions/web.py +++ b/DrissionPage/_functions/web.py @@ -300,10 +300,10 @@ def set_browser_cookies(page, cookies): except Exception: pass - if not page._browser_url.startswith('http'): + url = page._browser_url + if not url.startswith('http'): raise RuntimeError(f'未设置域名,请设置cookie的domain参数或先访问一个网站。{cookie}') - - ex_url = extract(page._browser_url) + ex_url = extract(url) d_list = ex_url.subdomain.split('.') d_list.append(f'{ex_url.domain}.{ex_url.suffix}' if ex_url.suffix else ex_url.domain) diff --git a/DrissionPage/_units/listener.py b/DrissionPage/_units/listener.py index c8f7385..c552fbf 100644 --- a/DrissionPage/_units/listener.py +++ b/DrissionPage/_units/listener.py @@ -167,7 +167,7 @@ class Listener(object): caught = 0 end = perf_counter() + timeout if timeout else None while True: - if timeout and perf_counter() > end: + if (timeout and perf_counter() > end) or self._driver._stopped.is_set(): return if self._caught.qsize() >= gap: yield self._caught.get_nowait() if gap == 1 else [self._caught.get_nowait() for _ in range(gap)] diff --git a/README.en.md b/README.en.md index a3a186f..ee4b0cf 100644 --- a/README.en.md +++ b/README.en.md @@ -62,7 +62,7 @@ After long-term practice, the author has stepped through countless pitfalls, and This library uses a fully self-developed kernel, has built-in N number of practical functions, and has integrated and optimized common functions. Compared with selenium, it has the following advantages: -- No webdriver features +- Not base on webdriver - No need to download different drivers for different browser versions - Runs faster - Can find elements across `