From 3aa5f266272039cda4fb6407d57a218623af6e93 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 22 May 2024 10:45:43 -0700 Subject: [PATCH] Update main.py --- apps/playwright-service/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/playwright-service/main.py b/apps/playwright-service/main.py index 544f113..a2f5e52 100644 --- a/apps/playwright-service/main.py +++ b/apps/playwright-service/main.py @@ -33,8 +33,12 @@ async def root(body: UrlModel): await page.goto( body.url, wait_until="load", - timeout=body.wait if body.wait else 15, + timeout=body.timeout if body.timeout else 15000, ) + # Wait != timeout. Wait is the time to wait after the page is loaded - useful in some cases were "load" / "networkidle" is not enough + if body.wait: + await page.wait_for_timeout(body.wait) + # await page.wait_for_selector("body", state="attached") page_content = await page.content() await context.close() json_compatible_item_data = {"content": page_content}