import sys, json from playwright.sync_api import sync_playwright ts = [float(x) for x in sys.argv[1:]] with sync_playwright() as p: b = p.chromium.launch(); pg = b.new_page(viewport={"width":1080,"height":1920}) pg.goto("file://" + __import__("os").path.abspath("page.html")); pg.wait_for_function("window.READY===true") for t in ts: pg.evaluate(f"render({t})"); pg.screenshot(path=f"shot_{t:05.1f}.jpg", type="jpeg", quality=80) print(pg.evaluate("1")) b.close()