OpenClaw(龙虾) 开源AI助手实战系列(四):让AI接管Chrome浏览器,自动抓取网页数据
前言
OpenClaw(龙虾) 开源AI助手实战系列(一):WSL环境安装与基础部署
OpenClaw(龙虾) 开源AI助手实战系列(二):接入 DeepSeek 模型并打通飞书机器人
OpenClaw 开源AI助手实战系列(三):给龙虾装上技能,让它帮你自动化办公
之前我们已经写介绍一些openclaw的基础文章,今天我们来说下关于openclaw操作浏览器的功能,日常在工作中,常需要一些数据,或者提交一些信息,需要与浏览器操作,那openclaw作为智能个人助理,他能帮我们去简单做一些收集的工作吗,比如就简单的访问百度拿个数据可行?
配置chrome
openclaw操作chrome浏览器,调试端口进行建立连接通信来操作,所以我们先在本机里先配置好远程调试端口,方法是右键chrome桌面快捷方式 ,浏览器的启动端口,在目标位置设置好调试端口和用户数据目录。如下图

我这边是这样设置的
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=18800 --user-data-dir="D:\chrome_debug_profile"
配置Openclaw
接着我们在WSL里,配置下openclaw.json文件,添加一节点,指定chrome所在的位置
"browser": { "executablePath": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "headless": false },
然后重启下openclaw就行了,然后在对话里然后我们在测试下。
Openclaw抓取百度数据
我们做个测试,在对话里告诉他,让他去百度里搜索下关键词“手机”,把结果进行统计分析告诉我,如图。

然后在一顿自我分析操作之后,他返回来了数据,如图:

太长了,我直接把他回复的发上来看,更直观。
好的,已获取百度搜索"手机"的结果。以下是主要内容:---## 🔍 百度搜索:"手机"### 📊 搜索分类| 分类 | 链接 ||------|------|| 网页 | 当前选中 || 图片 | image.baidu.com || 资讯 | 新闻 || 视频 | 视频搜索 || 笔记 | 笔记 || 地图 | 地图 || 贴吧 | 贴吧 || 文库 | 文库 |---### 🏷️ 搜索工具筛选全部 | 搜狐网 | 壁纸 | 新浪网 | 管家 | 克隆 | 凤凰网 | 搬家 | 腾讯网 | 定位在哪里打开 | 涨价最新消息---### 📦 主要搜索结果#### 1️⃣ 京东广告(置顶)**标题**: 最新版的手机 - 京东 JD.COM-正品商城,优质商品网..- **描述**: 最新版的手机-[京东官网]好物低价京东"GO"实惠,刷新超低折扣价,就等你来!京东品类全,折扣狠,送货更快...- **热门品类**: 美妆护肤、潮流服饰、时尚鞋靴、手机通讯、电脑办公、家用电器- **精选频道**: 3C 数码、服饰美妆、居家好物、母婴玩具、运动户外、日用百货、食品生鲜---### 🔥 百度热搜榜(右侧)| 排名 | 话题 | 状态 ||------|------|------|| 1 | 总书记为发展新质生产力作出新指引 | - || 2 | 刘慈欣 20 年前预言成真 | 🔥 热 || 3 | 毛宁向世界分享中国学生午睡神器 | 🔥 热 || 4 | 北斗万亿产业赛道启航 | - || 5 | "世界上顶好顶好的老太婆"走了 | - || 6 | 人民日报:月子中心超范围经营得管管 | 🆕 新 || 7 | 伊朗:将对美以发起"最强硬"打击 | 🆕 新 || 8 | 中国第五大城市群定了 | 🔥 热 || 9 | 四川一高校放 6 天假让学生赏花恋爱 | - || 10 | 网传"男二以下用 AI 演员" 于正发声 | 🆕 新 |---### 📝 页面提示- 搜索结果涉及价格仅作参考,请以商家官网为准- 页面底部有广告推广位:"想在此推广您的手机吗?" 咨询热线:400-800-8888---需要我帮你点击某个具体结果查看详情,或者搜索更具体的关键词吗?比如"手机排行榜 2026"或"最新款手机"?
当于返回的数据处理,你也可以根据自己的需求存于文档,数据库里都行。
更多关于浏览器的玩法,可参考他帮助命令
🦞 OpenClaw 2026.3.14 (0d776c8) — I've survived more breaking changes than your last three relationships.Usage: openclaw browser [options] [command]Manage OpenClaw's dedicated browser (Chrome/Chromium)Options: --browser-profile <name> Browser profile name (default from config) --expect-final Wait for final response (agent) (default: false) -h, --help Display help for command --json Output machine-readable JSON (default: false) --timeout <ms> Timeout in ms (default: "30000") --token <token> Gateway token (if required) --url <url> Gateway WebSocket URL (defaults to gateway.remote.url when configured)Commands: click Click an element by ref from snapshot close Close a tab (target id optional) console Get recent console messages cookies Read/write cookies create-profile Create a new browser profile delete-profile Delete a browser profile dialog Arm the next modal dialog (alert/confirm/prompt) download Click a ref and save the resulting download drag Drag from one ref to another errors Get recent page errors evaluate Evaluate a function against the page or a ref fill Fill a form with JSON field descriptors focus Focus a tab by target id (or unique prefix) highlight Highlight an element by ref hover Hover an element by ai ref navigate Navigate the current tab to a URL open Open a URL in a new tab pdf Save page as PDF press Press a key profiles List all browser profiles requests Get recent network requests (best-effort) reset-profile Reset browser profile (moves it to Trash) resize Resize the viewport responsebody Wait for a network response and return its body screenshot Capture a screenshot (MEDIA:<path>) scrollintoview Scroll an element into view by ref from snapshot select Select option(s) in a select element set Browser environment settings snapshot Capture a snapshot (default: ai; aria is the accessibility tree) start Start the browser (no-op if already running) status Show browser status stop Stop the browser (best-effort) storage Read/write localStorage/sessionStorage tab Tab shortcuts (index-based) tabs List open tabs trace Record a Playwright trace type Type into an element by ref from snapshot upload Arm file upload for the next file chooser wait Wait for time, selector, URL, load state, or JS conditions waitfordownload Wait for the next download (and save it)Examples: openclaw browser status openclaw browser start openclaw browser stop openclaw browser tabs openclaw browser open https://example.com openclaw browser focus abcd1234 openclaw browser close abcd1234 openclaw browser screenshot openclaw browser screenshot --full-page openclaw browser screenshot --ref 12 openclaw browser snapshot openclaw browser snapshot --format aria --limit 200 openclaw browser snapshot --efficient openclaw browser snapshot --labels openclaw browser navigate https://example.com openclaw browser resize 1280 720 openclaw browser click 12 --double openclaw browser type 23 "hello" --submit openclaw browser press Enter openclaw browser hover 44 openclaw browser drag 10 11 openclaw browser select 9 OptionA OptionB openclaw browser upload /tmp/openclaw/uploads/file.pdf openclaw browser fill --fields '[{"ref":"1","value":"Ada"}]' openclaw browser dialog --accept openclaw browser wait --text "Done" openclaw browser evaluate --fn '(el) => el.textContent' --ref 7 openclaw browser console --level error openclaw browser pdfDocs: docs.openclaw.ai/cli/browser
写在最后
目前为止,他的回复处理还是相当可以的,你当然可以用他做任何你想要做的,平时耗时的事,一些原本需要我们手动完成的重复操作如搜索信息、整理结果、简单分析等,都可以交给它来处理。这样你有时间花在更重要的事情上,而不是被这些琐碎流程消耗精力。
夜雨聆风