fix Screenshotter

This commit is contained in:
2026-03-21 18:25:15 +01:00
parent e94d96f153
commit 6c096e4300

View File

@@ -47,4 +47,18 @@ class Screenshotter:
}}
""")
# Hide fixed/absolute overlays (cookie banners, notifications, toasts)
# but preserve the ticket panel and its ancestors/descendants
page.evaluate(f"""
const ticket = document.querySelector('{ticket_selector}');
document.querySelectorAll('*').forEach(el => {{
if (ticket && (ticket.contains(el) || el.contains(ticket))) return;
const style = window.getComputedStyle(el);
if ((style.position === 'fixed' || style.position === 'sticky') &&
el.tagName !== 'BODY' && el.tagName !== 'HTML') {{
el.style.setProperty('display', 'none', 'important');
}}
}});
""")
page.locator(ticket_selector).screenshot(path=target_path)