42 lines
1.6 KiB
Python
Executable File
42 lines
1.6 KiB
Python
Executable File
|
|
from playwright.sync_api import sync_playwright
|
|
import os, time
|
|
|
|
os.makedirs("/opt/weval-l99/screenshots-b12", exist_ok=True)
|
|
|
|
targets = [
|
|
("01-weval-technology-platform", "https://weval-consulting.com/weval-technology-platform.html"),
|
|
("02-wevia-training-control-center", "https://weval-consulting.com/wevia-training.html"),
|
|
("03-wevia-master-chat", "https://weval-consulting.com/wevia-master.html"),
|
|
("04-business-kpi-dashboard", "https://weval-consulting.com/business-kpi-dashboard.php"),
|
|
("05-home-public", "https://weval-consulting.com/"),
|
|
]
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True, args=["--no-sandbox"])
|
|
ctx = browser.new_context(viewport={"width": 1920, "height": 1080})
|
|
page = ctx.new_page()
|
|
|
|
print(f"{'Page':<40} {'code':>5} {'size KB':>8} {'screenshot':>12}")
|
|
print("-"*72)
|
|
|
|
for name, url in targets:
|
|
try:
|
|
resp = page.goto(url + "?cb=b12screen", wait_until="networkidle", timeout=25000)
|
|
page.wait_for_timeout(2500)
|
|
code = resp.status if resp else 0
|
|
sz = len(page.content()) // 1024
|
|
path = f"/opt/weval-l99/screenshots-b12/{name}.png"
|
|
page.screenshot(path=path, full_page=True)
|
|
ok = "OK" if os.path.exists(path) and os.path.getsize(path) > 10000 else "FAIL"
|
|
print(f"{name:<40} {code:>5} {sz:>8} {ok:>12}")
|
|
except Exception as e:
|
|
print(f"{name:<40} ERROR {str(e)[:40]}")
|
|
|
|
browser.close()
|
|
|
|
# List screenshots
|
|
import subprocess
|
|
print("\\n=== Screenshots taken ===")
|
|
subprocess.run(["ls", "-la", "/opt/weval-l99/screenshots-b12/"])
|