"""Side A (WITH skill) — step 1: reconnaissance, per SKILL.md.
Navigate, wait for networkidle, screenshot, discover elements from the
rendered DOM. Selectors for the test script come from THIS output,
not from reading the HTML source."""
from playwright.sync_api import sync_playwright

URL = "http://localhost:8932/index.html"

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    page = browser.new_page()
    page.goto(URL)
    page.wait_for_load_state("networkidle")

    page.screenshot(path="/tmp/recon.png", full_page=True)
    print("Screenshot saved: /tmp/recon.png")

    inputs = page.locator("input").all()
    print(f"Found {len(inputs)} inputs:")
    for el in inputs:
        print(f"  - id={el.get_attribute('id')} type={el.get_attribute('type')} value={el.get_attribute('value')}")

    spans = page.locator("span").all()
    print(f"Found {len(spans)} output spans:")
    for el in spans:
        print(f"  - id={el.get_attribute('id')} text={el.inner_text()}")

    browser.close()
print("Recon complete.")
