Eerste commit voor Helvoirt Gevelreiniging
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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":900}).new_page()
|
||||
pg.goto("http://localhost:4321/", wait_until="networkidle", timeout=60000)
|
||||
pg.wait_for_timeout(2600)
|
||||
pg.screenshot(path=os.path.join(OUT,"b-hero.png")); print("OK b-hero")
|
||||
for y in range(0, pg.evaluate("document.body.scrollHeight"), 400):
|
||||
pg.evaluate(f"window.scrollTo(0,{y})"); pg.wait_for_timeout(80)
|
||||
pg.evaluate("window.scrollTo(0,0)"); pg.wait_for_timeout(700)
|
||||
el = pg.query_selector(".showcase"); el.scroll_into_view_if_needed(); pg.wait_for_timeout(500)
|
||||
el.screenshot(path=os.path.join(OUT,"b-showcase.png")); print("OK b-showcase")
|
||||
tiles = pg.query_selector_all(".stile")
|
||||
if tiles: tiles[0].hover(); pg.wait_for_timeout(700); el.screenshot(path=os.path.join(OUT,"b-showcase-hover.png")); print("OK b-showcase-hover")
|
||||
pg.screenshot(path=os.path.join(OUT,"b-full.png"), full_page=True); print("OK b-full")
|
||||
mp = b.new_context(viewport={"width":390,"height":844}, device_scale_factor=2).new_page()
|
||||
mp.goto("http://localhost:4321/", wait_until="networkidle", timeout=60000); mp.wait_for_timeout(2200)
|
||||
mp.screenshot(path=os.path.join(OUT,"b-mobile-hero.png")); print("OK b-mobile-hero")
|
||||
ms = mp.query_selector(".showcase"); ms.scroll_into_view_if_needed(); mp.wait_for_timeout(500)
|
||||
ms.screenshot(path=os.path.join(OUT,"b-mobile-showcase.png")); print("OK b-mobile-showcase")
|
||||
b.close()
|
||||
Reference in New Issue
Block a user