mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-11-29 18:47:34 +08:00
微调
This commit is contained in:
parent
ef577a9131
commit
415747731c
@ -300,10 +300,10 @@ def set_browser_cookies(page, cookies):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not page._browser_url.startswith('http'):
|
url = page._browser_url
|
||||||
|
if not url.startswith('http'):
|
||||||
raise RuntimeError(f'未设置域名,请设置cookie的domain参数或先访问一个网站。{cookie}')
|
raise RuntimeError(f'未设置域名,请设置cookie的domain参数或先访问一个网站。{cookie}')
|
||||||
|
ex_url = extract(url)
|
||||||
ex_url = extract(page._browser_url)
|
|
||||||
d_list = ex_url.subdomain.split('.')
|
d_list = ex_url.subdomain.split('.')
|
||||||
d_list.append(f'{ex_url.domain}.{ex_url.suffix}' if ex_url.suffix else ex_url.domain)
|
d_list.append(f'{ex_url.domain}.{ex_url.suffix}' if ex_url.suffix else ex_url.domain)
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class Listener(object):
|
|||||||
caught = 0
|
caught = 0
|
||||||
end = perf_counter() + timeout if timeout else None
|
end = perf_counter() + timeout if timeout else None
|
||||||
while True:
|
while True:
|
||||||
if timeout and perf_counter() > end:
|
if (timeout and perf_counter() > end) or self._driver._stopped.is_set():
|
||||||
return
|
return
|
||||||
if self._caught.qsize() >= gap:
|
if self._caught.qsize() >= gap:
|
||||||
yield self._caught.get_nowait() if gap == 1 else [self._caught.get_nowait() for _ in range(gap)]
|
yield self._caught.get_nowait() if gap == 1 else [self._caught.get_nowait() for _ in range(gap)]
|
||||||
|
@ -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:
|
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
|
- No need to download different drivers for different browser versions
|
||||||
- Runs faster
|
- Runs faster
|
||||||
- Can find elements across `<iframe>` without switching in and out
|
- Can find elements across `<iframe>` without switching in and out
|
||||||
|
@ -52,7 +52,7 @@ python 版本:3.6 及以上
|
|||||||
|
|
||||||
本库采用全自研的内核,内置无数实用功能,对常用功能作了整合和优化,对比 selenium,有以下优点:
|
本库采用全自研的内核,内置无数实用功能,对常用功能作了整合和优化,对比 selenium,有以下优点:
|
||||||
|
|
||||||
- 无 webdriver 特征
|
- 不基于 webdriver
|
||||||
- 无需为不同版本的浏览器下载不同的驱动
|
- 无需为不同版本的浏览器下载不同的驱动
|
||||||
- 运行速度更快
|
- 运行速度更快
|
||||||
- 可以跨`<iframe>`查找元素,无需切入切出
|
- 可以跨`<iframe>`查找元素,无需切入切出
|
||||||
|
Loading…
Reference in New Issue
Block a user