wait for load
Build and Push Docker Images / build-and-push (push) Successful in 34s

This commit is contained in:
2026-03-27 10:10:48 +01:00
parent 1c3545b377
commit 139023c09d
2 changed files with 12 additions and 2 deletions
+12 -2
View File
@@ -61,8 +61,18 @@ async def screenshot_url_service(decoded_url, full_page=True):
async def screenshot_operation(page):
try:
await page.goto(decoded_url, wait_until='networkidle', timeout=30000)
await page.wait_for_timeout(1000)
# Start navigation early, then wait for progressively stronger load signals.
await page.goto(decoded_url, wait_until='domcontentloaded', timeout=30000)
await page.wait_for_load_state('load', timeout=30000)
# Wait until the browser reports full document readiness.
await page.wait_for_function("document.readyState === 'complete'", timeout=30000)
# Ensure network has gone quiet so dynamic requests can finish.
await page.wait_for_load_state('networkidle', timeout=30000)
# Allow a brief settle period for final paints/animations.
await page.wait_for_timeout(1500)
screenshot_bytes = await page.screenshot(full_page=full_page, type='png')
return screenshot_bytes
except Exception as e: