Files
Cyrene/debug/cache/test_cdp_check_root.py
T
AskaEth a058b0ab8e fix: 第一轮修复 - 记忆管理/IoT操控/历史消息持久化/动作消息/链路优化/安全配置
- 修复记忆管理数据库连接不可用 (ai-core重编译+Unicode修复)
- 修复IoT子会话工具调用链路日志缺失
- 新增最终审查子会话(review_provider) 支持消息格式解析拆分
- 实现历史消息持久化(后端存储+前端分页加载)
- 前端新增动作消息(ActionMessage)类型和渲染
- 优化对话链路速度(非阻塞子会话+快速问候通道)
- JWT密钥环境变量化(无默认值启动panic)
- Token自动刷新机制(401拦截器+refresh接口)
- WebSocket指数退避重连(jitter+最大10次)
- localStorage清理一致性(cyrene_前缀+版本检查)
- IoT环境变量统一为IOT_SERVICE_URL
2026-05-21 23:10:07 +08:00

55 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""Quick CDP check: read root innerHTML"""
import json
import urllib.request
from websocket import create_connection
req = urllib.request.Request('http://127.0.0.1:9225/json/list')
resp = json.loads(urllib.request.urlopen(req, timeout=5))
ws_url = None
for p in resp:
if 'localhost:5199' in p.get('url', ''):
ws_url = p['webSocketDebuggerUrl']
break
if not ws_url:
print("No page found!")
exit(1)
ws = create_connection(ws_url, timeout=10)
def cdp(method, params, msg_id):
payload = json.dumps({"id": msg_id, "method": method, "params": params})
ws.send(payload)
def recv_id(tid, timeout=3):
ws.settimeout(timeout)
while True:
try:
m = json.loads(ws.recv())
if m.get("id") == tid:
return m.get("result", {})
except Exception:
return None
cdp("Runtime.enable", {}, 1)
recv_id(1)
# Get root innerHTML
cdp("Runtime.evaluate", {"expression": "document.getElementById('root').innerHTML.substring(0, 1000)", "returnByValue": True}, 10)
r = recv_id(10)
if r:
html = r.get("result", {}).get("value", "null")
print("=== Root innerHTML (前1000字符) ===")
print(html)
else:
print("No result")
# Root child count
cdp("Runtime.evaluate", {"expression": "document.getElementById('root').children.length", "returnByValue": True}, 11)
r = recv_id(11)
val = r.get("result", {}).get("value", "?") if r else "?"
print("\nRoot children:", val)
ws.close()