"""After click: dump screenshot + all new elements + all network requests. We need to know: 1. Did 996box actually call geetest (network log)? 2. If yes, what CSS class wraps the widget? 3. Are there any 996box-custom captcha-related elements? """ import asyncio import sys from pathlib import Path _HERE = Path(__file__).resolve().parent sys.path.insert(0, str(_HERE.parent / "src")) from playwright.async_api import async_playwright EDGE = r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" URL = "https://pc.hzwlan.com/login/account" async def main(): out = _HERE / "jfbym_diag" requests_log = [] async with async_playwright() as p: browser = await p.chromium.launch(executable_path=EDGE, headless=True) ctx = await browser.new_context(viewport={"width": 1366, "height": 768}) page = await ctx.new_page() page.on("request", lambda r: requests_log.append( f"-> {r.method} {r.url[:100]}" )) page.on("response", lambda r: requests_log.append( f"<- {r.status} {r.url[:100]}" )) await page.goto(URL, wait_until="networkidle", timeout=30000) await page.evaluate( "([u, p]) => {" " const setVal = (sel, v) => {" " const el = document.querySelector(sel);" " Object.getOwnPropertyDescriptor(" " window.HTMLInputElement.prototype, 'value').set.call(el, v);" " el.dispatchEvent(new Event('input', {bubbles: true}));" " };" " setVal('input#username', u);" " setVal('input#password', p);" " const btn = document.querySelector(" " 'button.login-form_box__submit_button');" " if (btn) { btn.disabled = false; btn.classList.remove('disabled'); }" "}", ["longwu988", "Longwu1988"], ) await page.wait_for_timeout(300) await page.locator("button.login-form_box__submit_button").first.click(force=True) # Wait long enough for any captcha widget to appear await page.wait_for_timeout(8000) await page.screenshot(path=str(out / "a1_after_click_v3.png"), full_page=True) info = await page.evaluate("""() => ({ url: location.href, any_geetest_class: !!document.querySelector('[class*=geetest]'), any_geetest_id: !!document.querySelector('[id*=geetest]'), any_geetest_iframe:!!document.querySelector('iframe[src*=geetest]'), any_canvas: document.querySelectorAll('canvas').length, captcha_els: [...document.querySelectorAll('[class*=captcha]')] .slice(0,15).map(e => ({tag:e.tagName, cls:e.className.slice(0,80)})), all_iframes: [...document.querySelectorAll('iframe')].map(i => i.src.slice(0,90)), body_text_snippet: document.body.innerText.slice(0, 500), })""") print(f"url: {info['url']}") print(f"any_geetest_class: {info['any_geetest_class']}") print(f"any_geetest_id: {info['any_geetest_id']}") print(f"any_geetest_iframe: {info['any_geetest_iframe']}") print(f"any_canvas: {info['any_canvas']}") print(f"captcha_els: {info['captcha_els']}") print(f"iframes: {info['all_iframes']}") print(f"body text snippet: {info['body_text_snippet']!r}") await browser.close() print(f"\nscreenshot: {out / 'a1_after_click_v3.png'}") print(f"\n--- network activity (last 20) ---") for r in requests_log[-20:]: print(f" {r}") asyncio.run(main())