21 lines
928 B
Python
21 lines
928 B
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/skills-index-{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":1400,"height":1200}, ignore_https_errors=True)
|
|
page = ctx.new_page()
|
|
# Capture skills index
|
|
page.goto(f"https://weval-consulting.com/skills/?nc={TS}", wait_until="networkidle", timeout=20000)
|
|
time.sleep(3)
|
|
page.screenshot(path=str(OUT/"skills-index.png"), full_page=True)
|
|
cards_count = page.evaluate("document.querySelectorAll('.card').length")
|
|
print(f"Skills index rendered · cards={cards_count}")
|
|
ctx.close(); browser.close()
|
|
except Exception as e:
|
|
print(f"err: {e}")
|