Skip to content

Commit 5be7c49

Browse files
committed
chore: chromium browser asnc handling
1 parent a82af04 commit 5be7c49

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

scrapegraphai/docloaders/chromium.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,13 @@ async def ascrape_playwright(self, url: str, browser_name: str = "chromium") ->
325325
await page.wait_for_load_state(self.load_state)
326326
results = await page.content()
327327
logger.info("Content scraped")
328+
await browser.close()
328329
return results
329330
except (aiohttp.ClientError, asyncio.TimeoutError, Exception) as e:
330331
attempt += 1
331332
logger.error(f"Attempt {attempt} failed: {e}")
332333
if attempt == self.retry_limit:
333334
raise RuntimeError(f"Failed to scrape after {self.retry_limit} attempts: {str(e)}")
334-
finally:
335-
await browser.close()
336335

337336
async def ascrape_with_js_support(self, url: str, browser_name: str = "chromium") -> str:
338337
"""

0 commit comments

Comments
 (0)