mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
3.0.19修复cookies_to_session()问题
This commit is contained in:
parent
1d4b6290ac
commit
656a1a9b20
@ -255,13 +255,13 @@ class WebPage(SessionPage, ChromiumPage, BasePage):
|
|||||||
if url.startswith('http'):
|
if url.startswith('http'):
|
||||||
self.get(url)
|
self.get(url)
|
||||||
|
|
||||||
def cookies_to_session(self, copy_user_agent: bool = False) -> None:
|
def cookies_to_session(self, copy_user_agent: bool = True) -> None:
|
||||||
"""把driver对象的cookies复制到session对象 \n
|
"""把driver对象的cookies复制到session对象 \n
|
||||||
:param copy_user_agent: 是否复制ua信息
|
:param copy_user_agent: 是否复制ua信息
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
if copy_user_agent:
|
if copy_user_agent:
|
||||||
selenium_user_agent = self.run_script("navigator.userAgent;")
|
selenium_user_agent = self._tab_obj.Runtime.evaluate(expression='navigator.userAgent;')['result']['value']
|
||||||
self.session.headers.update({"User-Agent": selenium_user_agent})
|
self.session.headers.update({"User-Agent": selenium_user_agent})
|
||||||
|
|
||||||
self.set_cookies(self._get_driver_cookies(as_dict=True), set_session=True)
|
self.set_cookies(self._get_driver_cookies(as_dict=True), set_session=True)
|
||||||
|
2
setup.py
2
setup.py
@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="DrissionPage",
|
name="DrissionPage",
|
||||||
version="3.0.16",
|
version="3.0.19",
|
||||||
author="g1879",
|
author="g1879",
|
||||||
author_email="g1879@qq.com",
|
author_email="g1879@qq.com",
|
||||||
description="A module that integrates selenium and requests session, encapsulates common page operations.",
|
description="A module that integrates selenium and requests session, encapsulates common page operations.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user