
OpenClawでブラウザ操作してみた
まえがき
皆さんお疲れ様です。
先日ようやっとOpenClawの設定をしなおして、そこからまたしばらく経ってしまいました。と言ってもまだ1ヶ月も経っていないのですがね。
それなのに最近はClaude DispatchやらGoogle AI StudioのBuildのアップデートやらの話題で、OpenClawへの熱が少し冷めてきている感がありますし、なんか一時期OpenClawくんブラウザ操作機能してくれなくてもういいかなぁとか思ったこともあったのですが。OpenClawも負けじとアップデートで改善されたので備忘で残します(検証Ver:2026.3.22-beta.1)
ほぼ自分用なので今回結構雑です!ごめんなさい!あと今回もDevコンテナ内で動かすので、ヘッドレスモードになります。ワークスペースは今回も/workspaces/OpenClaw/でやっていきます。
準備
各種インストール
Google Chrome(ブラウザ本体)
Dev Container では snap 版 Chromium は使えないため、公式の .deb ファイルを使います。
※apt install chromium は snap へのスタブになっているためNGです。必ず .deb を使ってください。
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt --fix-broken install -yPlaywright 後から追加でも可
アス比・表示崩れが起きたら Playwright 未インストールが原因のことがあるので(確証はないが)とりあえず入れておく
npm install playwright
npx playwright install chromium日本語フォント(文字化け対策)
未インストールだと日本語の表示が文字化けする可能性あり
sudo apt-get install -y fonts-noto-cjkopenclaw.json
ブラウザ操作のところはいろいろ試した結果こうなりました。
"browser": {
"enabled": true,
"executablePath": "/home/vscode/.cache/ms-playwright/chromium-1208/chrome-linux64/chrome",
"headless": true,
"noSandbox": true,
"defaultProfile": "openclaw",
"ssrfPolicy": {
"dangerouslyAllowPrivateNetwork": true
}
},ブラウザ本体パス⇒"executablePath": "インストール先による"
ヘッドレス⇒"headless": true ※X11 なし環境では必要
サンドボックス⇒"noSandbox": true ※コンテナ内では必要
ターミナルを2つ使う
※Gateway + ブラウザ起動手順(毎回)
ターミナル①:Gateway を起動したまま維持
openclaw gatewayターミナル②:ブラウザ起動、タイムゾーン設定(毎回)
openclaw browser start
openclaw browser set timezone Asia/Tokyoタイムゾーン設定はコンテナ再起動でリセットされます。忘れると RangeError: Invalid time zone specified: Etc/Unknown でクラッシュすることがあるので注意してください。
なお、ブラウザを止めるときは openclaw browser stop を実行します。
browser コマンド ~ 使い分け~
browser open
新しいタブ/ウィンドウで URL を開く
(初回アクセス・タブを追加したいとき)
#例
openclaw browser open https://www.google.com/browser navigate
現在のタブで URL に移動する
(既存タブを遷移させたいとき)
#例
openclaw browser navigate https://www.google.com/動作確認
依存パッケージ不足
#openclaw gatewayは別のターミナルで実行中...
/workspaces/OpenClaw $ openclaw browser start
🦞 OpenClaw 2026.3.22-beta.1 (d8d545b) — I've seen your commit messages. We'll work on that together.
│
◇
GatewayClientRequestError: Error: Failed to start Chrome CDP on port 18800 for profile "openclaw".
Chrome stderr:
[9350:9422:0412/142113.603568:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[9350:9422:0412/142114.316570:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[9350:9422:0412/142114.316755:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[9350:9422:0412/142114.365824:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[9350:9422:0412/142116.872137:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
DevTools listening on ws://127.0.0.1:18800/devtools/browser/d541e332-752e-42b2-aaba-8c0cf67a3119
[9350:9350:0412/142118.281103:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
[9350:9422:0412/142118.281300:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[9350:9350:0412/142118.501029:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
(process:9350): GLib-GIO-CRITICAL **: 14:21:19.050: g_settings_schema_source_lookup: assertion 'source != NULL' failedめっちゃエラー出るやん…必要な環境依存パッケージがいろいろ足りていないみたいです。というわけでAntigravityにDevコンテナである旨とコンソールログを伝えて修正させました。
必要な環境依存パッケージ(dbusやChrome向けのグラフィックライブラリなど)のインストールが完了し、システムに適用されました!
一つ重要な注意点があります。現在バックグラウンドで起動したままになっている `openclaw gateway` プロセスですが、**これらは依存パッケージをインストールする前に起動されたもの**であるため、内部の設定やOSの環境変数が更新されておらず、そのままでは再度ブラウザエラーになってしまいます。
お手数ですが、以下の手順をお願いいたします。
1. 現在 `openclaw gateway` が動いているターミナルで `Ctrl + C` を押してプロセスを一度停止する(または一度そのターミナルを閉じる)
2. 再度 `openclaw gateway` を立ち上げる
3. 別のターミナルから再度 `openclaw browser start` を実行する
これで先ほどの `GatewayClientRequestError` やDBusエラーが解消されてブラウザが起動するはずです。お試しいただけますでしょうか?と、申しているのでその通りやってみます。
再チャレンジ
#openclaw gatewayは別のターミナルで再実行...
vscode ➜ /workspaces/OpenClaw $ openclaw browser start
🦞 OpenClaw 2026.3.22-beta.1 (d8d545b)
Automation with claws: minimal fuss, maximal pinch.
│
◇
│
◇
🦞 browser [openclaw] running: true
vscode ➜ /workspaces/OpenClaw $ running: trueで帰ってきているので大丈夫そうです。とりあえずGoogleのトップページでも見てみますか。openclaw browser screenshotでスクリーンショットが取れます。
vscode ➜ /workspaces/OpenClaw $ openclaw browser open https://www.google.com/
🦞 OpenClaw 2026.3.22-beta.1 (d8d545b)
Finally, a use for that always-on Mac Mini under your desk.
│
◇
opened: https://www.google.com/
id: 427D405511CF5947358C8974C7CE26E7
vscode ➜ /workspaces/OpenClaw $ openclaw browser screenshot
🦞 OpenClaw 2026.3.22-beta.1 (d8d545b)
Half butler, half debugger, full crustacean.
│
◇
MEDIA:~/.openclaw/media/browser/0573c1f4-5cba-4cdd-b661-58684165bf6c.png
vscode ➜ /workspaces/OpenClaw $ 
さらにopenclaw browser snapshotというコマンドを使うと要素が取得できます。
vscode ➜ /workspaces/OpenClaw $ openclaw browser snapshot
🦞 OpenClaw 2026.3.22-beta.1 (d8d545b)
Give me a workspace and I'll give you fewer tabs, fewer toggles, and more oxygen.
│
◇
- generic [ref=e2]:
- navigation [ref=e3]:
- link "Googleについて" [ref=e4] [cursor=pointer]:
- /url: https://about.google/?fg=1&utm_source=google-JP&utm_medium=referral&utm_campaign=hp-header
- link "ストア" [ref=e5] [cursor=pointer]:
- /url: https://store.google.com/JP?utm_source=hp_header&utm_medium=google_ooo&utm_campaign=GS100042&hl=ja-JP
- generic [ref=e7]:
- generic [ref=e8]:
- link "Gmail" [ref=e10] [cursor=pointer]:
- /url: https://mail.google.com/mail/&ogbl
- link "画像を検索する" [ref=e12] [cursor=pointer]:
- /url: https://www.google.com/imghp?hl=ja&ogbl
- text: 画像
- button "Google アプリ" [ref=e15] [cursor=pointer]:
- img [ref=e16]
- link "ログイン" [ref=e20] [cursor=pointer]:
- /url: https://accounts.google.com/ServiceLogin?hl=ja&passive=true&continue=https://www.google.com/&ec=futura_exp_og_so_72776762_e
- img "Google" [ref=e23]
- search [ref=e31]:
- generic [ref=e33]:
- generic [ref=e35]:
- img [ref=e39]
- combobox "検索" [active] [ref=e42]
- generic [ref=e44]:
- button "音声で検索" [ref=e45] [cursor=pointer]:
- img [ref=e46]
- button "画像で検索" [ref=e48] [cursor=pointer]:
- img [ref=e49]
- generic [ref=e52]:
- button "Google 検索" [ref=e53] [cursor=pointer]
- button "I'm Feeling Lucky" [ref=e54] [cursor=pointer]
- generic [ref=e57]:
- text: "Google 検索は次の言語でもご利用いただけます:"
- link "English" [ref=e58] [cursor=pointer]:
- /url: https://www.google.com/setprefs?sig=0_m72QYQ4QuxtYxKXfn4IWx1tgfCM%3D&hl=en&source=homepage&sa=X&ved=0ahUKEwig76Trw-iTAxXXmq8BHQVMAXgQ2ZgBCBc
- contentinfo [ref=e60]:
- generic [ref=e61]: 日本
- generic [ref=e62]:
- generic [ref=e63]:
- link "広告" [ref=e64] [cursor=pointer]:
- /url: https://www.google.com/intl/ja_jp/ads/?subid=ww-ww-et-g-awa-a-g_hpafoot1_1!o2&utm_source=google.com&utm_medium=referral&utm_campaign=google_hpafooter&fg=1
- link "ビジネス" [ref=e65] [cursor=pointer]:
- /url: https://www.google.com/services/?subid=ww-ww-et-g-awa-a-g_hpbfoot1_1!o2&utm_source=google.com&utm_medium=referral&utm_campaign=google_hpbfooter&fg=1
- link "検索の仕組み" [ref=e66] [cursor=pointer]:
- /url: https://google.com/search/howsearchworks/?fg=1
- generic [ref=e67]:
- link "プライバシー" [ref=e68] [cursor=pointer]:
- /url: https://policies.google.com/privacy?hl=ja&fg=1
- link "規約" [ref=e69] [cursor=pointer]:
- /url: https://policies.google.com/terms?hl=ja&fg=1
- button "設定" [ref=e73] [cursor=pointer]:
- generic [ref=e74]: 設定
vscode ➜ /workspaces/OpenClaw $ 今回は「猫」で検索してみましょう。検索ボックス(combobox)の ref は e42 です。
vscode ➜ /workspaces/OpenClaw $ openclaw browser type e42 "猫"
🦞 OpenClaw 2026.3.22-beta.1 (d8d545b) — We ship features faster than Apple ships calculator updates.
│
◇
typed into ref e42
候補のトップにある「猫」の ref は e80なのでここをクリック
vscode ➜ /workspaces/OpenClaw $ openclaw browser click e80
🦞 OpenClaw 2026.3.22-beta.1 (d8d545b) — No $999 stand required.
│
◇
clicked ref e80 on https://www.google.com/
ダメでしたね。ロボットだと疑われました。
こうなるとどうにもなりませんので、あきらめるしかありません。
AIにXへの自動投稿をさせたい
そもそもブラウザ操作に興味を持ったのはXへ公式のAPI料金払わずに自動投稿をさせたいなぁというせこい思いからだったんですよね。。。
ここからはこのロボットだと疑われる問題、いわゆるreCAPTCHAをどうするかという話です。普通に突破することは無理なので、すでにログイン済みの状態のクッキーを流し込んでブラウザを操作するというアプローチをとります。
注意点
とはいえクッキーの有効期限はWebサイトによって異なりますが、短いものだと1~2週間くらいかと思いますので定期的にこのクッキーを流し込む作業を行うことになります。ログインして操作したいWebサイトによっては実用性の高いものではないかもしれません。
それを踏まえたうえで、今回はSocialDog経由でXにAIエージェントから投稿させる流れをご紹介していきます。
有料エリアについて
Xへの公式API以外での自動投稿は規約的にNGのため、できるけどリスクの高いものであることから、詳細は有料エリアとさせていただきます。また上記によりXの公式API以外で直接投稿させるとBANされる可能性が非常に高いためSocialDogを経由する手順をとっています。
ローカルのPCでSocialDogにログインしクッキーエクスポート
↓
Devコンテナ内のOpenClawのブラウザにクッキーをセット
↓
AIエージェントにSocialDogに予約投稿をしてもらう
という流れです。SocialDogのアカウントは事前に登録しXアカウントの紐づけも行っておきます。
ご購入前にご確認ください
動作環境:Dev Container(ヘッドレスモード) / OpenClaw 2026.3.22-beta.1 で検証。
仕様変更の可能性:AIツールの進化が速いため、執筆時(2026/4/13)と現在の仕様が異なる場合があります。
自己責任でお願いします:Cookie利用や自動操作によるアカウント制限(BAN)等のリスクについては、筆者は一切の責任を負いかねます。必ずご自身の判断で実施してください。
前提スキル:ターミナルでの基本操作やコンテナ環境の知識がある方向けの内容です。ワークスペースのパスは/workspaces/OpenClaw/を使用していますので適宜ご自身の環境に読み替えてください。
代替案:OpenClawにこだわらず、より一般的なXへの自動投稿をお探しの方は「Make」や「Buffer」などの外部連携ツールの利用をおすすめします。
上記お読みいただいてそれでも読みたいよ!という稀有な方がいましたら返金可能で設定しますのでご購入いただければと思います。