From 1c212b21b4cc80549d5dc4bd6c7015e1f28394db Mon Sep 17 00:00:00 2001 From: g1879 Date: Tue, 22 Nov 2022 18:12:00 +0800 Subject: [PATCH] =?UTF-8?q?3.0.7=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E8=B7=B3=E8=BD=AC=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E9=A1=B5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/chromium_page.py | 9 +++++---- setup.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DrissionPage/chromium_page.py b/DrissionPage/chromium_page.py index 715522f..70c2c81 100644 --- a/DrissionPage/chromium_page.py +++ b/DrissionPage/chromium_page.py @@ -84,7 +84,7 @@ class ChromiumPage(ChromiumBase): raise TypeError('只能接收Tab或DriverOptions类型参数。') self._first_run = False - self.main_tab = self.tab_id + self.main_tab: str = self.tab_id def _init_page(self, tab_id: str = None) -> None: """新建页面、页面刷新、切换标签页后要进行的cdp参数初始化 @@ -203,7 +203,7 @@ class ChromiumPage(ChromiumBase): self._control_session.get(f'http://{self.address}/json/new{url}') while len(self.tabs) < begin_len: pass - self.to_tab() + self.to_tab(self.tabs[0]) def to_main_tab(self) -> None: """跳转到主标签页""" @@ -220,12 +220,13 @@ class ChromiumPage(ChromiumBase): tab_id = self.main_tab if tab_id not in tabs: tab_id = tabs[0] - if tab_id == self.tab_id: - return if activate: self._control_session.get(f'http://{self.address}/json/activate/{tab_id}') + if tab_id == self.tab_id: + return + self._driver.stop() self._init_page(tab_id) if self.ready_state == 'complete': diff --git a/setup.py b/setup.py index 1842bbc..1002260 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8') as fh: setup( name="DrissionPage", - version="3.0.6", + version="3.0.7", author="g1879", author_email="g1879@qq.com", description="A module that integrates selenium and requests session, encapsulates common page operations.",