22 lines
1.1 KiB
Python
22 lines
1.1 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/godmode-final-{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":1700}, record_video_dir=str(OUT), record_video_size={"width":1600,"height":1700}, ignore_https_errors=True)
|
|
page = ctx.new_page()
|
|
page.goto(f"https://weval-consulting.com/wevia-autonomy-dashboard.html?validated={TS}", wait_until="networkidle", timeout=25000)
|
|
time.sleep(8)
|
|
kpis = page.evaluate("[...document.querySelectorAll('.kpi .v')].map(e => e.innerText)")
|
|
score = page.evaluate("document.querySelector('.autonomy-score-box .score')?.innerText?.slice(0,10)")
|
|
page.screenshot(path=str(OUT/"godmode-validated.png"), full_page=True)
|
|
ctx.close(); browser.close()
|
|
print(f"score={score}")
|
|
print(f"kpis={kpis}")
|
|
except Exception as e:
|
|
print(f"err: {e}")
|