42 lines
2.0 KiB
Python
42 lines
2.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/wtp-state-{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":1100}, ignore_https_errors=True)
|
|
page = ctx.new_page()
|
|
page.goto(f"https://weval-consulting.com/weval-technology-platform.html?s={TS}", wait_until="networkidle", timeout=25000)
|
|
time.sleep(6)
|
|
page.screenshot(path=str(OUT/"01-wtp-live.png"), full_page=False)
|
|
# Check drawer button
|
|
drawer_btn = page.evaluate("""() => {
|
|
const btns = [...document.querySelectorAll('button, [role=button], .drawer-trigger, [id*=drawer], [class*=drawer], [class*=menu]')];
|
|
return btns.slice(0,10).map(b => ({id: b.id, cls: b.className.slice(0,50), text: b.innerText?.slice(0,40)}));
|
|
}""")
|
|
print("BUTTONS found:")
|
|
for b in drawer_btn: print(f" {b}")
|
|
# Check sidebar
|
|
sidebar = page.evaluate("""() => {
|
|
const items = [...document.querySelectorAll('.sidebar a, nav a, .nav-item, .nav-link')];
|
|
return items.slice(0,30).map(a => a.textContent?.trim().slice(0,40)).filter(Boolean);
|
|
}""")
|
|
print("\nSIDEBAR items:")
|
|
for s in sidebar: print(f" {s}")
|
|
# Check KPIs
|
|
kpis = page.evaluate("""() => {
|
|
const out = {};
|
|
document.querySelectorAll('[id*=vm-][id*=agents], [id*=vm-][id*=skill], [id*=vm-][id*=cov], [id*=vm-gauge]').forEach(el => {
|
|
out[el.id] = (el.textContent || el.innerHTML || '').slice(0,50);
|
|
});
|
|
return out;
|
|
}""")
|
|
print("\nKPIs:")
|
|
for k, v in kpis.items(): print(f" {k}: {v}")
|
|
ctx.close(); browser.close()
|
|
except Exception as e:
|
|
print(f"err: {e}")
|