fix Screenshotter
This commit is contained in:
@@ -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)
|
page.locator(ticket_selector).screenshot(path=target_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user