fix(browsers): Close pages that give error

This was causing the browser and the whole code to stand still.
This commit is contained in:
Karim shoair
2026-01-11 18:34:13 +02:00
parent 32f4f2adf4
commit d5b9ed11b2
3 changed files with 8 additions and 2 deletions
@@ -158,6 +158,8 @@ class DynamicSession(SyncSession, DynamicSessionMixin):
except Exception as e:
page_info.mark_error()
page_info.page.close()
self.page_pool.pages.remove(page_info)
raise e
@@ -298,4 +300,6 @@ class AsyncDynamicSession(AsyncSession, DynamicSessionMixin):
except Exception as e: # pragma: no cover
page_info.mark_error()
await page_info.page.close()
self.page_pool.pages.remove(page_info)
raise e