From 1eacad4ef34ad22f3521e4e9d7f47b24102a6797 Mon Sep 17 00:00:00 2001 From: Matt Joyce Date: Sat, 1 Jun 2024 13:46:16 +1000 Subject: [PATCH] Clarifying wait type and name --- apps/playwright-service/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/playwright-service/main.py b/apps/playwright-service/main.py index a2a6d759..3c1ff19e 100644 --- a/apps/playwright-service/main.py +++ b/apps/playwright-service/main.py @@ -20,7 +20,7 @@ app = FastAPI() class UrlModel(BaseModel): """Model representing the URL and associated parameters for the request.""" url: str - wait: int = None + wait_after_load: int = 0 timeout: int = 15000 browser: Browser = None @@ -67,8 +67,8 @@ async def root(body: UrlModel): timeout=body.timeout, ) # 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) + if body.wait_after_load > 0: + await page.wait_for_timeout(body.wait_after_load) page_content = await page.content() await context.close()