关于 reserve-with-google
通过浏览器自动化在 Google Maps 中查找并完成餐厅及商家预订的技能。它指导 Agent 处理不同平台的预订表单,并要求提交前先取得用户确认。
主要功能
- 01在 Google Maps 中查找预订选项
- 02处理第三方预订流程
- 03填写预订信息和特别要求
- 04提交前要求用户确认
- 05指导处理预订错误
适用场景
- 01查找支持在线预订的餐厅
- 02为选定商家预订座位
- 03时段不可用时提供替代选项
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ koala73/ reservewithgoogle-skill --skill reserve-with-google安装后在 Claude Code 中输入/reserve-with-google确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
README.mdassets/selectors.jsonreferences/REFERENCE.mdFORMS.mdTHIRD-PARTY-PROVIDERS.mdscripts/search-places.shsearch-and-book.shsetup-profile.sh详细介绍
使用 Google 预订
通过浏览器自动化,使用 Google 地图自动预订餐厅和商务服务。
快速参考
| 提供商 | 预订网址模式 | 特别说明 |
|---|---|---|
| SevenRooms | sevenrooms.com/reservations/{venue} | 请参阅 SEVENROUNDS.md |
| OpenTable | opentable.com | 为获得最佳效果,请使用 --headed |
| Resy | resy.com | 通常需要通过电话验证 |
| Yelp | yelp.com/reservations | 通常需要登录 |
常见问题:
- 称谓下拉菜单:使用
find text "Mr." click - 政策复选框:使用
find text "I agree..." click
前提条件
- 已安装
agent-browser:npm install -g agent-browser - 可访问互联网
- 可选:已完成身份验证的 Google 配置文件(请参阅下方的配置文件设置)
- 可选:用于身份验证路由的代理服务器(请参阅下方的代理设置)
开始前
向用户收集以下信息:
- 搜索查询 — 要预订什么/在哪里预订(例如,“芝加哥市中心的意大利餐厅”)
- 日期 — 期望的预订日期
- 时间 — 首选时间
- 人数 — 就餐人数(餐厅)
- 姓名 — 预订人姓名
- 电话 — 联系电话
- 电子邮箱 — 接收确认邮件的邮箱
- 特殊要求 — 可选(例如,“靠窗座位”“需要儿童椅”)
配置文件设置(一次性)
为获得最佳效果,请使用已登录 Google 账号的持久浏览器配置文件:
agent-browser --headed --profile ~/.reservegoogle open "https://accounts.google.com"
用户只需手动登录一次。配置文件会在各个会话之间保留。如果没有配置文件,则使用访客模式。
替代方案:使用状态保存/加载功能,实现可移植的身份验证:
# After logging in:
agent-browser state save ~/.reservegoogle-auth.json
# In future sessions:
agent-browser state load ~/.reservegoogle-auth.json
agent-browser open "https://www.google.com/maps"
代理设置
通过经过身份验证的代理路由流量,以避免速率限制、地理限制,或使用住宅 IP:
agent-browser --proxy http://user:[email protected]:8080 open "https://www.google.com/maps"
agent-browser --proxy socks5://user:[email protected]:1080 open "https://www.google.com/maps"
代理标志只需传递给用于启动会话的 open 命令。同一会话中的后续命令会继续使用该代理。
与配置文件结合使用,可创建经过身份验证且经代理路由的会话:
agent-browser --headed --profile ~/.reservegoogle --proxy http://user:[email protected]:8080 open "https://accounts.google.com"
通过环境变量设置,避免每次都传递该参数:
export AGENT_BROWSER_PROXY="http://user:[email protected]:8080"
agent-browser open "https://www.google.com/maps"
核心工作流
重要: 每次交互前都必须使用 snapshot。每次页面更新后,Refs 都会变化。切勿将元素引用硬编码。
步骤 1:打开 Google 地图并搜索
agent-browser --profile ~/.reservegoogle open "https://www.google.com/maps"
agent-browser snapshot -i
在快照中找到搜索框,然后:
agent-browser fill @<searchBoxRef> "<user's search query>"
agent-browser press Enter
agent-browser wait --load networkidle
agent-browser snapshot -i
解析结果列表。向用户展示地点,并标明哪些地点支持预订(在结果中查找“预订餐桌”“在线预订”或类似文字)。
步骤 2:选择地点
用户选好地点后:
agent-browser click @<resultRef>
agent-browser wait --load networkidle
agent-browser snapshot -i
在快照中查找预订按钮。常见文字模式:
- “预订餐桌”
- “在线预订”
- “预约”
- “安排时间”
- “查找餐桌”
如果未找到预订按钮:告知用户该地点不支持在线预订。根据搜索结果推荐附近的其他地点。
步骤 3:开始预订
agent-browser click @<bookButtonRef>
agent-browser wait --load networkidle
判断发生了什么:
检查网址,使用 agent-browser get url:
- 仍在
google.com/maps→ Google 原生小组件或 iframe opentable.com→ OpenTable 流程(请参阅 THIRD-PARTY-PROVIDERS.md)resy.com→ Resy 流程vagaro.com→ Vagaro 流程yelp.com/reservations→ Yelp 流程toasttab.com→ Toast 流程- 其他域名 → 通用第三方流程
检查 iframe:如果预订小组件加载在 iframe 中:
agent-browser snapshot -i
如果在快照中看到 iframe 元素,找出其 CSS 选择器(例如 id 或 name 属性),然后切换到该 iframe:
agent-browser frame "#booking-iframe"
agent-browser snapshot -i
与 iframe 交互后,返回主框架:
agent-browser frame main
第 4 步:选择日期、时间和人数
截取页面快照,以识别预订表单元素:
agent-browser snapshot -i
对于餐厅,请查找:
- 日期选择器:日历组件或日期下拉菜单
- 可选时段:显示可选时间的按钮或下拉菜单
- 人数:数字输入框、下拉菜单或 +/- 按钮
填写用户的偏好:
agent-browser click @<datePickerRef>
# Navigate to correct date in calendar
agent-browser click @<targetDateRef>
agent-browser click @<timeSlotRef>
agent-browser fill @<partySizeRef> "<count>"
如果首选时间不可选,请再次截取快照,并向用户展示可选方案。
第 5 步:填写个人信息
agent-browser snapshot -i
agent-browser fill @<nameFieldRef> "<user's name>"
agent-browser fill @<phoneFieldRef> "<user's phone>"
agent-browser fill @<emailFieldRef> "<user's email>"
如果有特殊要求字段:
agent-browser fill @<specialRequestsRef> "<user's requests>"
截取快照,确认所有字段均已正确填写。
第 6 步:提交前确认
必须:点击最终预订按钮前,向用户展示摘要:
Booking Summary:
- Place: [restaurant name]
- Date: [date]
- Time: [time]
- Party size: [count]
- Name: [name]
- Special requests: [if any]
Confirm this booking?
只有在用户确认后才能继续。
第 7 步:完成预订
agent-browser click @<confirmButtonRef>
agent-browser wait --load networkidle
agent-browser snapshot -i
查找确认标识:
- “Reservation confirmed”
- “Booking confirmed”
- 确认编号/代码
- “You're all set”
截取屏幕截图,供用户留存:
agent-browser screenshot confirmation.png
向用户报告:
- 确认状态
- 确认编号(如有显示)
- 已确认的日期、时间和人数
- 餐厅提供的任何特别说明
错误处理
检测到 CAPTCHA
告知用户:“Google 正在显示 CAPTCHA。请手动完成。”等待用户处理后再继续。
时段已不可选
重新截取快照,展示剩余可选时段,并请用户选择其他时段。
需要付款
告知用户:“此预订需要付款。我无法填写付款信息。请手动完成付款。”截取显示付款页面的屏幕截图。
无可选时段
建议用户选择其他日期/时间、附近类似的餐厅,或稍后重试。
有多个预订选项
如果该场所提供多种预订类型(堂食、外带、候位名单),请在继续前询问用户选择哪一种。
会话管理
并行搜索时使用 --session:
agent-browser --session search1 --profile ~/.reservegoogle open "https://www.google.com/maps"
参考文件
经验总结(2026 年 2 月)
SevenRooms 专用模式
许多餐厅使用的 SevenRooms 预订系统有一些独特之处:
称谓下拉菜单问题
**问题:**点击选择按钮(@e2)不一定会以 agent-browser 可交互的方式显示选项。
**解决方案:**改用基于文本的选择方式:
agent-browser find text "Mr." click
如果匹配结果不唯一(存在多个“Mr.”元素):
agent-browser find text --exact "Mr." click
政策复选框检测
问题:“I agree to the venue's required policy *”复选框元素不会在快照中以标准复选框的形式显示。
**解决方案:**直接点击政策文本:
agent-browser find text "I agree to the venue's required policy" click
表单会话超时
**问题:**许多预订系统(包括 SevenRooms)会为用户保留餐桌约 20 分钟。如果填写表单耗时过长,保留就会过期,必须重新选择。
解决方案:
- 快速填写表单,不要过度斟酌
- 重新选择流程:返回 → 重新选择时间 → 以访客身份继续 → 称谓 → 填写字段 → 政策 → 提交
表单字段重置行为
**观察:**称谓可能会在会话重置后保留,但名字、姓氏、电子邮件和电话号码字段通常会清空。
**解决方案:**最终提交前,务必核对并重新填写所有表单字段。
更快的预订脚本
在同一场所重复预订时:
# Open booking page
agent-browser open "https://www.sevenrooms.com/reservations/restaurantname"
# Select date/time/guests → SEARCH
agent-browser snapshot -i
agent-browser click @<dateRef>
agent-browser click @<timeRef>
agent-browser fill @<partySizeRef> "3"
agent-browser click @<searchButtonRef>
agent-browser snapshot -i
# Click desired time slot
agent-browser click @<timeSlotRef>
# Quick guest flow
agent-browser find text "Continue as guest" click
agent-browser click @<selectTitleRef>
agent-browser find text "Mr." click
# Fill and submit
agent-browser fill @<firstNameRef> "John"
agent-browser fill @<lastNameRef> "Doe"
agent-browser fill @<emailRef> "[email protected]"
agent-browser fill @<phoneRef> "+1234567890"
agent-browser find text "I agree to the venue's required policy" click
agent-browser click @<submitRef>
元素引用变化
**重要:**元素引用(@e1、@e2 等)会在每次页面加载或交互时发生变化。点击前务必立即运行 snapshot。
错误恢复模式
如果提交失败或保留过期:
- 检查控制台日志:
agent-browser console - 查找“Released hold”消息(表示超时)
- 返回时间选择页面:
agent-browser click @<backRef> - 重新选择相同的时段
- 从访客流程继续