Files

18 lines
797 B
Python

from playwright.sync_api import sync_playwright
import os
OUT = os.path.abspath("shots")
with sync_playwright() as p:
b = p.chromium.launch(headless=True)
pg = b.new_context(viewport={"width": 1440, "height": 900}).new_page()
pg.goto("http://localhost:4321/over-ons", wait_until="networkidle", timeout=60000)
pg.wait_for_timeout(500)
el = pg.query_selector(".prefooter")
el.scroll_into_view_if_needed()
pg.wait_for_timeout(600)
el.screenshot(path=os.path.join(OUT, "prefooter.png"))
# measure phone/email link heights
h = pg.eval_on_selector_all("a.prefooter__val", "els=>els.map(e=>{const r=e.getBoundingClientRect();return Math.round(r.width)+'x'+Math.round(r.height);})")
print("prefooter link sizes:", h)
print("OK prefooter.png")
b.close()