Files
weval-l99/pw-training.py
2026-04-19 18:05:32 +02:00

22 lines
1.0 KiB
Python

import time
from pathlib import Path
from playwright.sync_api import sync_playwright
TS = time.strftime("%Y%m%d-%H%M%S")
OUT = Path(f"/var/www/html/test-report/training-sync-{TS}")
OUT.mkdir(parents=True, exist_ok=True)
try:
with sync_playwright() as p:
browser = p.chromium.launch(headless=True, args=["--no-sandbox"])
ctx = browser.new_context(viewport={"width":1500,"height":1000}, ignore_https_errors=True)
page = ctx.new_page()
page.goto("https://weval-consulting.com/wevia-training.html", wait_until="networkidle", timeout=20000)
time.sleep(6) # Wait for fetch
val = page.evaluate("document.getElementById('vm-agt-val')?.textContent")
desc = page.evaluate("document.getElementById('vm-agt-desc')?.textContent")
page.screenshot(path=str(OUT/"training-after-sync.png"), full_page=True)
print(f"SVG vm-agt-val: {val}")
print(f"SVG vm-agt-desc: {desc}")
ctx.close(); browser.close()
except Exception as e:
print(f"err: {e}")