← 返回知识库 # CDP Chrome 反检测流程 ## 每次操作 Chrome 前必须做的 3 件事 1. 用 `skill_view(name='cdp-anti-detection')` 加载反检测技能 2. 连接 CDP → 先注入 `Page.addScriptToEvaluateOnNewDocument` 隐藏 webdriver 3. 确认 navigator.webdriver 返回 undefined ## 为什么 Google 检测到 CDP 自动化特征(navigator.webdriver=true)后直接干掉会话, 让你以为"登录掉了",实际上是机器人检测杀了连接。 ## 快速验证命令 ```python docker exec desktop python3 -c " import requests, json tabs = requests.get('http://127.0.0.1:9222/json').json() print(len(tabs), 'tabs') " ``` ## 参考文件 - `~/wiki/cdp/anti_detect_example.py` — 注入示例脚本