企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## 命令行 先通过命令返回 ws 连接 ``` chrome --disable-background-networking \ --enable-features=NetworkService,NetworkServiceInProcess \ --disable-background-timer-throttling \ --disable-backgrounding-occluded-windows \ --disable-breakpad \ --disable-client-side-phishing-detection \ --disable-component-extensions-with-background-pages \ --disable-default-apps \ --disable-dev-shm-usage \ --disable-extensions \ --disable-features=TranslateUI,BlinkGenPropertyTrees \ --disable-hang-monitor \ --disable-ipc-flooding-protection \ --disable-popup-blocking \ --disable-prompt-on-repost \ --disable-renderer-backgrounding \ --disable-sync \ --force-color-profile=srgb \ --metrics-recording-only \ --no-first-run \ --enable-automation \ --password-store=basic \ --use-mock-keychain \ --remote-debugging-port=0 \ about:blank \ ``` 执行后返回,并启动 chrome ``` DevTools listening on ws://127.0.0.1:59763/devtools/browser/5f7af2a1-63fe-41d3-a93f-8b40dbae2f76 ``` 得到的ws 连接就可以用于 devtools protcol 的交互 在访问浏览器得到用于连接的ws ``` http://127.0.0.1:59763/json ``` 如 ``` [ { "description": "", "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:51137/devtools/page/33C651CE67480ACC2A540BDEC8244A75", "id": "33C651CE67480ACC2A540BDEC8244A75", "title": "about:blank", "type": "page", "url": "about:blank", "webSocketDebuggerUrl": "ws://127.0.0.1:51137/devtools/page/33C651CE67480ACC2A540BDEC8244A75" } ] ``` 通过 `webSocketDebuggerUrl`可得到连接地址 **触发跳转协议** ``` { "id":3, "method":"Page.navigate", "params":{ "url":"https://www.baidu.cn/" } } ``` 跳转到 baidu.com