from playwright.sync_api import sync_playwright import os OUT = os.path.abspath("shots") os.makedirs(OUT, exist_ok=True) URL = "https://helvoirt-gevelreiniging.mike-197.workers.dev/" widths = [1900, 1440, 1280, 1024] with sync_playwright() as p: browser = p.chromium.launch(headless=True) for w in widths: ctx = browser.new_context(viewport={"width": w, "height": 860}, device_scale_factor=1) page = ctx.new_page() page.goto(URL, wait_until="networkidle", timeout=60000) page.wait_for_timeout(2600) page.screenshot(path=os.path.join(OUT, f"hero-{w}.png")) print(f"OK hero-{w}.png") ctx.close() # mobile m = browser.new_context(viewport={"width": 390, "height": 844}, device_scale_factor=2) mp = m.new_page() mp.goto(URL, wait_until="networkidle", timeout=60000) mp.wait_for_timeout(2600) mp.screenshot(path=os.path.join(OUT, "hero-mobile.png"), full_page=False) print("OK hero-mobile.png") browser.close()