downloaded file debugger accessible (#3338)

This commit is contained in:
LawyZheng
2025-09-02 15:43:07 +08:00
committed by GitHub
parent 9a699e70f8
commit 275426eb33
9 changed files with 121 additions and 17 deletions

View File

@@ -656,13 +656,20 @@ class BrowserState:
LOG.info("browser context is created")
if await self.get_working_page() is None:
page: Page | None = None
if browser_address and len(self.browser_context.pages) > 0:
page = self.browser_context.pages[0]
await self.set_working_page(page, 0)
else:
pages = [
http_page
for http_page in self.browser_context.pages
if urlparse(http_page.url).scheme in ["http", "https"]
]
if len(pages) > 0:
page = pages[0]
if page is None:
page = await self.browser_context.new_page()
await self.set_working_page(page, 0)
await self._close_all_other_pages()
await self.set_working_page(page, 0)
await self._close_all_other_pages()
if url:
await self.navigate_to_url(page=page, url=url)