#!/usr/bin/env python3 """Deep DOM Diagnostic v2""" from playwright.sync_api import sync_playwright BASE_URL = "http://localhost:3001" with sync_playwright() as p: browser = p.chromium.launch(headless=True) page = browser.new_page(viewport={"width": 1280, "height": 900}) console_logs = [] page.on("console", lambda msg: console_logs.append(f"{msg.type}: {msg.text[:150]}")) # Navigate directly to CTA area page.goto(BASE_URL + "/#cta") page.wait_for_load_state("networkidle") page.wait_for_timeout(2000) # Extra wait for dynamic imports print("=== CTA SECTION DEEP PROBE ===") cta = page.locator("#cta") print(f"#cta exists: {cta.count() > 0}") if cta.count() > 0: html = cta.first.inner_html() print(f"#cta innerHTML length: {len(html)}") print(f"#cta innerHTML (first 500 chars): {html[:500]}") # Check for anchor tags anchors = cta.locator("a") print(f"\n#cta tags: {anchors.count()}") for i in range(anchors.count()): a = anchors.nth(i) txt = a.inner_text().strip() href = a.get_attribute("href") or "" cls = a.get_attribute("class") or "" print(f" a[{i}]: text='{txt}' href={href} class={cls[:80]}") # Check all clickable elements clickables = cta.locator("a, button, [role='button'], [role='link']") print(f"\n#cta all clickables: {clickables.count()}") print("\n=== WHY-US DEEP PROBE ===") whyus = page.locator("#why-us") print(f"#why-us exists: {whyus.count() > 0}") if whyus.count() > 0: anchors = whyus.locator("a") print(f"#why-us tags: {anchors.count()}") for i in range(anchors.count()): a = anchors.nth(i) txt = a.inner_text().strip() href = a.get_attribute("href") or "" print(f" a[{i}]: text='{txt}' href={href}") print("\n=== HEADER CONSULT DEEP PROBE ===") header = page.locator("header") header_anchors = header.locator("a") print(f"header tags: {header_anchors.count()}") for i in range(header_anchors.count()): a = header_anchors.nth(i) txt = a.inner_text().strip()[:30] href = a.get_attribute("href") or "" aria = a.get_attribute("aria-label") or "" if '咨询' in txt or '咨询' in aria or 'contact' in href: print(f" CONSULT a[{i}]: text='{txt}' href={href} aria={aria}") header_buttons = header.locator("button") print(f"header