fix browser cdp connection (#3339)

This commit is contained in:
LawyZheng
2025-09-02 15:53:48 +08:00
committed by GitHub
parent 275426eb33
commit aee181c307

View File

@@ -657,6 +657,7 @@ class BrowserState:
if await self.get_working_page() is None:
page: Page | None = None
use_existing_page = False
if browser_address and len(self.browser_context.pages) > 0:
pages = [
http_page
@@ -665,10 +666,12 @@ class BrowserState:
]
if len(pages) > 0:
page = pages[0]
use_existing_page = True
if page is None:
page = await self.browser_context.new_page()
await self.set_working_page(page, 0)
if not use_existing_page:
await self._close_all_other_pages()
if url: