mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
4.0.4.21修复wait.eles_loaded()和设置cookies问题
This commit is contained in:
parent
5578bf57a5
commit
ef577a9131
@ -14,4 +14,4 @@ from ._configs.chromium_options import ChromiumOptions
|
|||||||
from ._configs.session_options import SessionOptions
|
from ._configs.session_options import SessionOptions
|
||||||
|
|
||||||
__all__ = ['ChromiumPage', 'ChromiumOptions', 'SessionOptions', 'SessionPage', 'WebPage', '__version__']
|
__all__ = ['ChromiumPage', 'ChromiumOptions', 'SessionOptions', 'SessionPage', 'WebPage', '__version__']
|
||||||
__version__ = '4.0.4.20'
|
__version__ = '4.0.4.21'
|
||||||
|
@ -207,9 +207,9 @@ def cookies_to_tuple(cookies):
|
|||||||
|
|
||||||
elif isinstance(cookies, str):
|
elif isinstance(cookies, str):
|
||||||
c_dict = {}
|
c_dict = {}
|
||||||
for attr in cookies.strip().rstrip(';,').split(',' if ',' in cookies else ';'):
|
for attr in cookies.strip().rstrip(';, ').split(',' if ',' in cookies else ';'):
|
||||||
attr_val = attr.strip().split('=', 1)
|
attr_val = attr.strip().split('=', 1)
|
||||||
c_dict[attr_val[0]] = attr_val[1] if len(attr_val) == 2 else ''
|
c_dict[attr_val[0]] = attr_val[1] if len(attr_val) == 2 else True
|
||||||
cookies = _dict_cookies_to_tuple(c_dict)
|
cookies = _dict_cookies_to_tuple(c_dict)
|
||||||
|
|
||||||
elif isinstance(cookies, dict):
|
elif isinstance(cookies, dict):
|
||||||
@ -300,6 +300,9 @@ def set_browser_cookies(page, cookies):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if not page._browser_url.startswith('http'):
|
||||||
|
raise RuntimeError(f'未设置域名,请设置cookie的domain参数或先访问一个网站。{cookie}')
|
||||||
|
|
||||||
ex_url = extract(page._browser_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)
|
||||||
|
@ -98,8 +98,12 @@ class BaseWaiter(OriginWaiter):
|
|||||||
driver.run('DOM.discardSearchResults', searchId=r['searchId'])
|
driver.run('DOM.discardSearchResults', searchId=r['searchId'])
|
||||||
return False
|
return False
|
||||||
searchId = r['searchId']
|
searchId = r['searchId']
|
||||||
ids = driver.run('DOM.getSearchResults', searchId=r['searchId'], fromIndex=0,
|
ids = driver.run('DOM.getSearchResults', searchId=searchId, fromIndex=0,
|
||||||
toIndex=r['resultCount'] - 1)['nodeIds']
|
toIndex=r['resultCount'])
|
||||||
|
if 'error' in ids:
|
||||||
|
return False
|
||||||
|
|
||||||
|
ids = ids['nodeIds']
|
||||||
res = False
|
res = False
|
||||||
for i in ids:
|
for i in ids:
|
||||||
r = driver.run('DOM.describeNode', nodeId=i)
|
r = driver.run('DOM.describeNode', nodeId=i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user