shu/fix cdp connect with browser path (#2057)

This commit is contained in:
Shuchang Zheng
2025-04-01 01:19:14 -04:00
committed by GitHub
parent c14086ea85
commit 3fc6e2532f
2 changed files with 10 additions and 4 deletions

View File

@@ -417,7 +417,13 @@ class BrowserState:
pages = self.browser_context.pages
for page in pages:
if page != cur_page:
await page.close()
try:
async with asyncio.timeout(2):
await page.close()
except asyncio.TimeoutError:
LOG.warning("Timeout to close the page. Skip closing the page", url=page.url)
except Exception:
LOG.exception("Error while closing the page", url=page.url)
async def check_and_fix_state(
self,