From 24cbea0c97da3557eeb7ea7d2f52681c61930fc0 Mon Sep 17 00:00:00 2001 From: Oliver Hofmann Date: Sun, 17 May 2026 13:58:03 +0200 Subject: [PATCH] debug: add DOM element counts per poll for diagnosis --- src/teampulse/monitor.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/teampulse/monitor.py b/src/teampulse/monitor.py index 5939c96..5a14c62 100644 --- a/src/teampulse/monitor.py +++ b/src/teampulse/monitor.py @@ -137,6 +137,17 @@ class Monitor: return name def poll_new_messages(self) -> list[ChatMessage]: + result = self._page.evaluate(r"""() => { + const counts = { + channelAll: document.querySelectorAll("[data-tid='channel-pane-message']").length, + chatAll: document.querySelectorAll("[data-tid='chat-pane-message']").length, + }; + const isVisible = el => { const r = el.getBoundingClientRect(); return r.width > 0 && r.height > 0; }; + counts.channelVisible = Array.from(document.querySelectorAll("[data-tid='channel-pane-message']")).filter(isVisible).length; + counts.chatVisible = Array.from(document.querySelectorAll("[data-tid='chat-pane-message']")).filter(isVisible).length; + return counts; + }""") + print(f" [DOM] channel={result['channelAll']}(vis:{result['channelVisible']}) chat={result['chatAll']}(vis:{result['chatVisible']})") raw = self._page.evaluate(_POLL_JS) if raw: print(f" [POLL] {len(raw)} Elemente, davon {sum(1 for r in raw if r['id'] not in self._seen_message_ids)} neu")