Files
weval-l99/pw-hub-v2.py
2026-04-19 15:48:31 +02:00

33 lines
1.4 KiB
Python

import time, json
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/hub-v2-{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":1600,"height":1400}, ignore_https_errors=True)
page = ctx.new_page()
page.goto(f"https://weval-consulting.com/wevia-unified-hub.html?v2={TS}", wait_until="networkidle", timeout=30000)
time.sleep(10)
# Summary
page.screenshot(path=str(OUT/"1-summary.png"), full_page=True)
kpis = page.evaluate("[...document.querySelectorAll('.kpi .v')].map(e => e.innerText)")
dedup = page.evaluate("document.getElementById('dedup-count')?.innerText")
print(f"KPIs: {kpis}")
print(f"Dedup: {dedup}")
# Agents
page.evaluate("show('agents')")
time.sleep(4)
cards = page.evaluate("document.querySelectorAll('#agents-grid .card').length")
print(f"Agents cards visible: {cards}")
page.screenshot(path=str(OUT/"2-agents.png"), full_page=True)
# Intents
page.evaluate("show('intents')")
time.sleep(4)
page.screenshot(path=str(OUT/"3-intents.png"), full_page=True)
ctx.close(); browser.close()
except Exception as e:
print(f"err: {e}")