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.
OpenClaw installed and running (this skill uses OpenClaw's browser command)
OpenClaw Browser Relay Chrome extension installed and configured
127.0.0.1:18792 by defaultGoogle account logged in within Chrome (Gemini requires authentication)
Use profile=chrome to relay through your existing Chrome (not the isolated profile=openclaw-managed)
bash
# 1. Open Gemini in Chrome
open -a "Google Chrome" "https://gemini.google.com"
# 2. Manually click the Browser Relay extension icon on the Gemini tab to attach
# (the badge will show "ON" when attached)
# 3. Verify relay is connected
browser action=status profile=chrome
# Should show cdpReady: true
# 4. List tabs
browser action=tabs profile=chrome
# Note the targetId for the Gemini tab
Gemini uses a Quill rich-text editor ( contenteditable div), not a standard <textarea>. You must inject text via JavaScript:
text
browser action=act profile=chrome targetId=<id> request={
"kind": "evaluate",
"fn": "(() => { const editor = document.querySelector('div.ql-editor[contenteditable=\"true\"]'); if (!editor) return 'editor not found'; editor.focus(); editor.innerHTML = '<p>YOUR_QUERY_HERE</p>'; editor.dispatchEvent(new Event('input', { bubbles: true })); return 'ok'; })()"
}
Then submit:
text
browser action=act profile=chrome targetId=<id> request={"kind":"press","key":"Enter"}
Open Gemini in Chrome and manually attach the Browser Relay extension to the tab.
bash
open -a "Google Chrome" "https://gemini.google.com"
# Then click the Browser Relay extension icon on the Gemini tab
text
browser action=tabs profile=chrome
Find the Gemini tab entry and note its targetId.
text
browser action=act profile=chrome targetId=<id> request={
"kind": "evaluate",
"fn": "(() => { const editor = document.querySelector('div.ql-editor[contenteditable=\"true\"]'); if (!editor) return 'editor not found'; editor.focus(); editor.innerHTML = '<p>What is quantum computing?</p>'; editor.dispatchEvent(new Event('input', { bubbles: true })); return 'ok'; })()"
}
text
browser action=act profile=chrome targetId=<id> request={"kind":"press","key":"Enter"}
Gemini may take 10–60 seconds. Poll for completion by checking if the stop button has disappeared:
text
browser action=act profile=chrome targetId=<id> request={
"kind": "evaluate",
"fn": "(() => { const stop = document.querySelector('button[aria-label*=\"Stop\"]'); return stop ? 'generating' : 'done'; })()"
}
Option A — Clipboard (recommended, preserves Markdown formatting):
text
# Take a snapshot and find the Copy button
browser action=snapshot profile=chrome targetId=<id>
# Click the Copy button by its ref from the snapshot
browser action=act profile=chrome targetId=<id> request={"kind":"click","ref":"<copy_button_ref>"}
# Read from clipboard
pbpaste
Option B — DOM extraction (fallback):
text
browser action=act profile=chrome targetId=<id> 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; })()"
}
For unrelated queries, start a fresh chat to avoid context pollution:
text
browser action=navigate profile=chrome targetId=<id> targetUrl="https://gemini.google.com"
The response is complete when:
⚠️ Important: Understand these risks before using this skill.
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.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.127.0.0.1 and requires an auth token, preventing remote access.ProblemSolutioncdpReady: falseClick the Browser Relay extension icon on the Gemini tab to re-attachTab not foundRun browser action=tabs profile=chrome to refresh tab listEditor not foundPage may not be fully loaded; wait and retry. Gemini may have changed DOM — check for div.ql-editorCopy button not foundResponse may still be generating; poll stop button status firstLogin wallEnsure Chrome is logged into a Google accountContext overflowNavigate to gemini.google.com for a fresh chat