From 169c293143d7145f6f28f3d54b0ef70f14b2faf4 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sun, 10 Jul 2022 13:55:29 +0200 Subject: [PATCH] Playwright - log console errors to output --- changedetectionio/content_fetcher.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/changedetectionio/content_fetcher.py b/changedetectionio/content_fetcher.py index 5e8d1603..bb269455 100644 --- a/changedetectionio/content_fetcher.py +++ b/changedetectionio/content_fetcher.py @@ -309,7 +309,10 @@ class base_html_playwright(Fetcher): page.set_default_navigation_timeout(90000) page.set_default_timeout(90000) - # Bug - never set viewport size BEFORE page.goto + # Listen for all console events and handle errors + page.on("console", lambda msg: print(f"Playwright console: Watch URL: {url} {msg.type}: {msg.text} {msg.args}")) + + # Bug - never set viewport size BEFORE page.goto # Waits for the next navigation. Using Python context manager # prevents a race condition between clicking and waiting for a navigation.