浏览器登录 + X/Twitter 发帖

手动登录(推荐)

当网站需要登录时,请在主机浏览器 Profile(即 openclaw 浏览器)中手动登录

不要把密码告诉 Agent。自动登录往往会触发反爬虫防御,甚至导致账号被锁定。

让龙虾帮你操作网站,但账号密码这道门,还是自己过一遍更安全。

返回浏览器主文档:Browser

使用的是哪个 Chrome Profile?

OpenClaw 控制的是一个专属 Chrome Profile(名称为 openclaw,橙色 UI 标识)。它与你的日常浏览器 Profile 完全独立。

Agent 浏览器工具调用逻辑:

  • 默认选择:Agent 应使用其隔离的 openclaw 浏览器。
  • 仅在已登录会话至关重要且用户在场可批准挂载提示时,才使用 profile="user"
  • 如果你有多个用户浏览器 Profile,请显式指定,而不是让 Agent 猜测。

访问该 Profile 的两种简便方式:

  1. 让 Agent 打开浏览器,然后自己登录。
  2. 通过 CLI 打开
openclaw browser start
openclaw browser open https://x.com

如果有多个 Profile,请传入 --browser-profile <name>(默认为 openclaw)。

X/Twitter:推荐流程

  • 阅读/搜索/查看帖子: 使用主机浏览器(手动登录)。
  • 发布更新: 使用主机浏览器(手动登录)。

沙盒化 + 主机浏览器访问

沙盒浏览器会话更容易触发爬虫检测。对于 X/Twitter(及其他严格的网站),优先使用主机浏览器。

如果 Agent 在沙盒中运行,浏览器工具默认使用沙盒。要允许访问主机浏览器:

{
  agents: {
    defaults: {
      sandbox: {
        mode: "non-main",
        browser: {
          allowHostControl: true,
        },
      },
    },
  },
}

然后指向主机浏览器:

openclaw browser open https://x.com --browser-profile openclaw --target host

或者对发布更新的 Agent 直接禁用沙盒化。