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/portal-fix-{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":1100}, ignore_https_errors=True, record_video_dir=str(OUT), record_video_size={"width":1500,"height":1100}) page = ctx.new_page() page.goto(f"https://weval-consulting.com/weval-portal.html?f={TS}", wait_until="networkidle", timeout=20000) time.sleep(5) page.screenshot(path=str(OUT/"01-hero-fixed.png"), full_page=False) page.evaluate("window.scrollTo(0, 1100)") time.sleep(3) page.screenshot(path=str(OUT/"02-cats-fixed.png"), full_page=False) # Scroll to Dashboards page.evaluate("document.querySelector('[data-cat=\"Dashboards/Hubs\"]')?.scrollIntoView()") time.sleep(3) page.screenshot(path=str(OUT/"03-dashboards-cat.png"), full_page=False) # Check first link first_link = page.evaluate("""() => { const l = document.querySelector('.lnk'); return l ? {href: l.href, title: l.querySelector('.t')?.textContent, meta: l.querySelector('.m')?.textContent} : null; }""") print(f"First link: {first_link}") # Search test page.locator("#search").fill("agents") time.sleep(2) page.screenshot(path=str(OUT/"04-search-agents.png"), full_page=False) visible_links = page.evaluate("[...document.querySelectorAll('.lnk')].filter(l => l.style.display !== 'none').length") print(f"After search 'agents': visible_links={visible_links}") ctx.close(); browser.close() except Exception as e: print(f"err: {e}")