Files
helvoirtgevelreiniging.nl/scripts/touch.py
T

21 lines
1.0 KiB
Python

from playwright.sync_api import sync_playwright
with sync_playwright() as p:
b = p.chromium.launch(headless=True)
# mobiel touch-targets
pg = b.new_context(viewport={"width":390,"height":844}).new_page()
pg.goto("http://localhost:4321/", wait_until="networkidle", timeout=60000)
sels = {"hamburger":"#hamburger","header phone":".header__phone","sticky CTA":"#stickyMobileCta",
"footer link":".footer__nav a","btn-text (proof)":".proof .btn-text"}
print("=== MOBIEL TOUCH-TARGETS (min 44px) ===")
for name,sel in sels.items():
el = pg.query_selector(sel)
if el:
box = el.bounding_box()
if box: print(f" {name:18} {box['width']:.0f} x {box['height']:.0f}")
else: print(f" {name:18} (niet gevonden)")
# hero image loading attrs
print("\n=== HERO BEELDEN ===")
imgs = pg.eval_on_selector_all(".ba .ba__img", "els=>els.map(e=>({src:e.currentSrc.split('/').pop(), loading:e.loading, fp:e.getAttribute('fetchpriority')}))")
for i in imgs: print(" ", i)
b.close()