Eerste commit voor Helvoirt Gevelreiniging
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from playwright.sync_api import sync_playwright
|
||||
import os
|
||||
|
||||
OUT = os.path.abspath("shots")
|
||||
os.makedirs(OUT, exist_ok=True)
|
||||
|
||||
with sync_playwright() as p:
|
||||
b = p.chromium.launch(headless=True)
|
||||
pg = b.new_context(viewport={"width": 1440, "height": 820}, device_scale_factor=2).new_page()
|
||||
pg.goto("http://localhost:4321/", wait_until="networkidle", timeout=60000)
|
||||
pg.wait_for_timeout(2600)
|
||||
pg.screenshot(path=os.path.join(OUT, "hero-desktop.png"))
|
||||
print("OK hero-desktop.png")
|
||||
|
||||
# diensten-sectiekop
|
||||
head = pg.query_selector(".svc__head")
|
||||
if head:
|
||||
# scroll de sectie in beeld zodat lazy/reveals laden
|
||||
head.scroll_into_view_if_needed()
|
||||
pg.wait_for_timeout(700)
|
||||
head.screenshot(path=os.path.join(OUT, "diensten-head.png"))
|
||||
lines = pg.eval_on_selector("#diensten-h", "e => { const r = e.getClientRects(); return r.length; }")
|
||||
h = pg.eval_on_selector("#diensten-h", "e => Math.round(e.getBoundingClientRect().height)")
|
||||
print(f"OK diensten-head.png (h2 hoogte={h}px)")
|
||||
b.close()
|
||||
Reference in New Issue
Block a user