This commit is contained in:
g1879 2024-04-02 15:06:27 +08:00
parent ef577a9131
commit 415747731c
4 changed files with 6 additions and 6 deletions

View File

@ -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)

View File

@ -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)]

View File

@ -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 `<iframe>` without switching in and out

View File

@ -52,7 +52,7 @@ python 版本3.6 及以上
本库采用全自研的内核,内置无数实用功能,对常用功能作了整合和优化,对比 selenium有以下优点
- 无 webdriver 特征
- 不基于 webdriver
- 无需为不同版本的浏览器下载不同的驱动
- 运行速度更快
- 可以跨`<iframe>`查找元素,无需切入切出