Gemini Browser Skill
Query Google Gemini (gemini.google.com) via OpenClaw Browser Relay and extract responses.
⚠️ Security Notice: This skill operates on your real Chrome browser with
your logged-in Google session via CDP (Chrome DevTools Protocol). The agent will
have access to anything visible in the attached tab. Only attach tabs you
explicitly intend for the agent to control. See Security Considerations.
Prerequisites
- - OpenClaw installed and running (this skill uses OpenClaw's
browser command) - OpenClaw Browser Relay Chrome extension installed and configured
- Extension binds to loopback
127.0.0.1:18792 by default
- Gateway auth token must be configured in extension options
- - Google account logged in within Chrome (Gemini requires authentication)
- Use
profile=chrome to relay through your existing Chrome (not the isolated profile=openclaw-managed)
Quick Start
CODEBLOCK0
Input Method
Gemini uses a Quill rich-text editor (contenteditable div), not a standard <textarea>. You must inject text via JavaScript:
CODEBLOCK1
Then submit:
CODEBLOCK2
Complete Workflow
1. Prepare
Open Gemini in Chrome and manually attach the Browser Relay extension to the tab.
CODEBLOCK3
2. Get Tab ID
CODEBLOCK4
Find the Gemini tab entry and note its targetId.
3. Input Query
CODEBLOCK5
4. Submit
CODEBLOCK6
5. Wait for Response
Gemini may take 10–60 seconds. Poll for completion by checking if the stop button has disappeared:
CODEBLOCK7
6. Extract Response
Option A — Clipboard (recommended, preserves Markdown formatting):
CODEBLOCK8
Option B — DOM extraction (fallback):
CODEBLOCK9
New Chat
For unrelated queries, start a fresh chat to avoid context pollution:
CODEBLOCK10
Response Completion Signals
The response is complete when:
- - The stop button disappears
- A copy button appears below the response
- Suggested follow-up chips appear
Security Considerations
⚠️ Important: Understand these risks before using this skill.
- 1. Session access:
profile=chrome uses your real Chrome with all logged-in sessions. The agent can see and interact with anything in the attached tab, including your Google account context. - JavaScript evaluation: The
evaluate action runs arbitrary JavaScript in the page context. This skill limits it to DOM manipulation for the input field, but the mechanism itself is powerful. - Manual attachment required: The Browser Relay extension must be manually clicked by you to attach — the agent cannot auto-attach to arbitrary tabs. Only attach the specific Gemini tab.
- Loopback only: The relay binds to
127.0.0.1 and requires an auth token, preventing remote access. - Recommendation: Use a separate Chrome profile dedicated to AI automation, logged into a non-primary Google account, to limit exposure.
Troubleshooting
| Problem | Solution |
|---|
| INLINECODE11 | Click the Browser Relay extension icon on the Gemini tab to re-attach |
| Tab not found |
Run
browser action=tabs profile=chrome to refresh tab list |
| Editor not found | Page may not be fully loaded; wait and retry. Gemini may have changed DOM — check for
div.ql-editor |
| Copy button not found | Response may still be generating; poll stop button status first |
| Login wall | Ensure Chrome is logged into a Google account |
| Context overflow | Navigate to
gemini.google.com for a fresh chat |
Gemini 浏览器技能
通过 OpenClaw 浏览器中继查询 Google Gemini(gemini.google.com)并提取响应。
⚠️ 安全须知:此技能在您的真实 Chrome 浏览器上运行,并通过 CDP(Chrome DevTools 协议)使用您已登录的 Google 会话。代理可以访问所附加标签页中可见的任何内容。请仅附加您明确希望代理控制的标签页。请参阅安全注意事项。
前提条件
- - OpenClaw 已安装并运行(此技能使用 OpenClaw 的 browser 命令)
- OpenClaw 浏览器中继 Chrome 扩展已安装并配置
- 扩展默认绑定到回环地址 127.0.0.1:18792
- 网关认证令牌必须在扩展选项中配置
- - Chrome 中已登录 Google 账户(Gemini 需要身份验证)
- 使用 profile=chrome 通过您现有的 Chrome 进行中继(而非隔离的 profile=openclaw-managed)
快速开始
bash
1. 在 Chrome 中打开 Gemini
open -a Google Chrome https://gemini.google.com
2. 手动点击 Gemini 标签页上的浏览器中继扩展图标以附加
(附加后徽章将显示ON)
3. 验证中继已连接
browser action=status profile=chrome
应显示 cdpReady: true
4. 列出标签页
browser action=tabs profile=chrome
记下 Gemini 标签页的 targetId
输入方式
Gemini 使用 Quill 富文本编辑器(contenteditable div),而非标准的
browser action=act profile=chrome targetId= request={
kind: evaluate,
fn: (() => { const editor = document.querySelector(div.ql-editor[contenteditable=\true\]); if (!editor) return editor not found; editor.focus(); editor.innerHTML = YOURQUERYHERE
; editor.dispatchEvent(new Event(input, { bubbles: true })); return ok; })()
}
然后提交:
browser action=act profile=chrome targetId= request={kind:press,key:Enter}
完整工作流程
1. 准备
在 Chrome 中打开 Gemini,并手动附加浏览器中继扩展到该标签页。
bash
open -a Google Chrome https://gemini.google.com
然后点击 Gemini 标签页上的浏览器中继扩展图标
2. 获取标签页 ID
browser action=tabs profile=chrome
找到 Gemini 标签页条目,记下其 targetId。
3. 输入查询
browser action=act profile=chrome targetId= request={
kind: evaluate,
fn: (() => { const editor = document.querySelector(div.ql-editor[contenteditable=\true\]); if (!editor) return editor not found; editor.focus(); editor.innerHTML = 什么是量子计算?
; editor.dispatchEvent(new Event(input, { bubbles: true })); return ok; })()
}
4. 提交
browser action=act profile=chrome targetId= request={kind:press,key:Enter}
5. 等待响应
Gemini 可能需要 10–60 秒。通过检查停止按钮是否消失来轮询完成状态:
browser action=act profile=chrome targetId= request={
kind: evaluate,
fn: (() => { const stop = document.querySelector(button[aria-label*=\Stop\]); return stop ? generating : done; })()
}
6. 提取响应
选项 A — 剪贴板(推荐,保留 Markdown 格式):
截取快照并找到复制按钮
browser action=snapshot profile=chrome targetId=
通过快照中的引用点击复制按钮
browser action=act profile=chrome targetId= request={kind:click,ref:buttonref>}
从剪贴板读取
pbpaste
选项 B — DOM 提取(备选):
browser action=act profile=chrome targetId= request={
kind: evaluate,
fn: (() => { const msgs = document.querySelectorAll(.model-response-text); if (msgs.length === 0) return no response found; return msgs[msgs.length - 1].innerText; })()
}
新建对话
对于不相关的查询,请开始新对话以避免上下文污染:
browser action=navigate profile=chrome targetId= targetUrl=https://gemini.google.com
响应完成信号
当以下情况出现时,表示响应已完成:
- - 停止按钮消失
- 响应下方出现复制按钮
- 出现建议的后续话题标签
安全注意事项
⚠️ 重要提示:在使用此技能前,请了解以下风险。
- 1. 会话访问:profile=chrome 使用您真实的 Chrome 浏览器及所有已登录会话。代理可以查看和交互附加标签页中的任何内容,包括您的 Google 账户上下文。
- JavaScript 评估:evaluate 操作在页面上下文中运行任意 JavaScript。此技能将其限制为输入字段的 DOM 操作,但该机制本身功能强大。
- 需要手动附加:浏览器中继扩展必须由您手动点击附加 — 代理无法自动附加到任意标签页。请仅附加特定的 Gemini 标签页。
- 仅限回环:中继绑定到 127.0.0.1 并需要认证令牌,防止远程访问。
- 建议:使用单独的 Chrome 配置文件专门用于 AI 自动化,登录非主要 Google 账户,以限制风险暴露。
故障排除
| 问题 | 解决方案 |
|---|
| cdpReady: false | 点击 Gemini 标签页上的浏览器中继扩展图标重新附加 |
| 未找到标签页 |
运行 browser action=tabs profile=chrome 刷新标签页列表 |
| 未找到编辑器 | 页面可能未完全加载;等待后重试。Gemini 可能更改了 DOM — 检查 div.ql-editor |
| 未找到复制按钮 | 响应可能仍在生成中;先轮询停止按钮状态 |
| 登录墙 | 确保 Chrome 已登录 Google 账户 |
| 上下文溢出 | 导航到 gemini.google.com 开始新对话 |