feat: complete T-105b account login reuse

This commit is contained in:
chengma
2026-07-06 15:01:50 +08:00
parent 7ac0dcd00e
commit 0dad4151ef
12 changed files with 276 additions and 30 deletions
+14
View File
@@ -43,6 +43,20 @@ def close_tab(target_id, host=None):
return response.ok
def activate_tab(target_id, host=None):
"""Bring an existing Chrome target/page to the foreground."""
if not target_id:
return False
ver = http_get("/json/version", host=host)
b = CDP(ver["webSocketDebuggerUrl"])
try:
b.send("Target.activateTarget", {"targetId": target_id})
finally:
b.close()
return True
class CDP:
"""单个 target 的 CDP 客户端:命令同步、事件回调异步。"""