38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
"""Debug: check what the page actually renders."""
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True)
|
|
page = browser.new_page(viewport={"width": 1920, "height": 1080})
|
|
|
|
# Capture console logs
|
|
logs = []
|
|
page.on("console", lambda msg: logs.append(f"[{msg.type}] {msg.text}"))
|
|
|
|
page.goto("http://localhost:5173/", wait_until="networkidle")
|
|
page.wait_for_timeout(3000) # Wait longer for SPA to render
|
|
|
|
# Get page title and URL
|
|
print(f"URL: {page.url}")
|
|
print(f"Title: {page.title()}")
|
|
|
|
# Get body HTML (first 2000 chars)
|
|
body_html = page.evaluate("document.body.innerHTML.substring(0, 2000)")
|
|
print(f"\nBody HTML (first 2000):\n{body_html}")
|
|
|
|
# Check for navbar
|
|
has_navbar = page.evaluate("!!document.querySelector('.navbar-container')")
|
|
print(f"\nnavbar-container exists: {has_navbar}")
|
|
|
|
# Check for any visible elements
|
|
all_divs = page.evaluate("document.querySelectorAll('div').length")
|
|
print(f"Total divs: {all_divs}")
|
|
|
|
# Print console logs
|
|
print(f"\nConsole logs ({len(logs)}):")
|
|
for log in logs[:20]:
|
|
print(f" {log}")
|
|
|
|
page.screenshot(path=r"c:\Users\12914\Desktop\vscode\shots\debug_1920.png")
|
|
browser.close()
|