""" Debug: Capture exact login request and response. """ from playwright.sync_api import sync_playwright BASE_URL = "http://localhost:80" with sync_playwright() as p: browser = p.chromium.launch(headless=True) page = browser.new_page(viewport={"width": 1440, "height": 900}) api_responses = [] def on_response(response): if "/auth/login" in response.url or "/system/" in response.url: try: body = response.text() api_responses.append({ "url": response.url, "status": response.status, "body": body[:500], }) except: api_responses.append({ "url": response.url, "status": response.status, "body": "", }) page.on("response", on_response) page.goto(f"{BASE_URL}/login", wait_until="networkidle", timeout=30000) page.wait_for_timeout(1000) page.locator('input[placeholder="用户名"]').fill("admin") page.locator('input[placeholder="密码"]').fill("admin123") page.locator('button:has-text("登")').click() page.wait_for_timeout(8000) print(f"URL: {page.url}") print(f"\nAPI responses ({len(api_responses)}):") for r in api_responses: print(f"\n {r['url']}") print(f" Status: {r['status']}") print(f" Body: {r['body'][:300]}") browser.close()