33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import os, sys
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
py = sys.executable
|
|
base = r"C:\Users\12914\Desktop\vscode\login-templates\v3-mobile"
|
|
out = r"C:\Users\12914\Desktop\vscode\login-templates\v3-mobile\screenshots"
|
|
os.makedirs(out, exist_ok=True)
|
|
|
|
templates = [
|
|
("template1-bottomsheet.html", "t1-bottomsheet.png"),
|
|
("template2-gradient-card.html", "t2-gradient-card.png"),
|
|
("template3-clean-white.html", "t3-clean-white.png"),
|
|
("template4-fullscreen-dark.html", "t4-fullscreen-dark.png"),
|
|
("template5-playful-colorful.html", "t5-playful.png"),
|
|
]
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch()
|
|
ctx = browser.new_context(
|
|
viewport={"width":390, "height":844},
|
|
device_scale_factor=2,
|
|
)
|
|
page = ctx.new_page()
|
|
for fname, oname in templates:
|
|
url = f"file:///{os.path.join(base, fname).replace(os.sep, '/')}"
|
|
page.goto(url, wait_until="networkidle", timeout=15000)
|
|
page.wait_for_timeout(1500)
|
|
opath = os.path.join(out, oname)
|
|
page.screenshot(path=opath, full_page=True)
|
|
print(f"OK: {oname}")
|
|
browser.close()
|
|
print("All done")
|