browser-replay

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Browser Replay

浏览器重放

Re-drive a recorded session trajectory. Used for regression testing, deterministic re-runs, and as the verification path that
browser-record
plus
browser-selectors
actually produces something replayable.
This skill is the load-bearing assumption of the v0.2.0 architecture. ADR-0001 Verification §4 requires ≥80% replay success across 10 distinct sites of varying drift profiles before the proposal moves from
Proposed
Accepted
. If you find replay unreliable, capture the failure modes in
findings.md
and report them up the ADR.
重新驱动已录制的会话轨迹。用于回归测试、确定性重跑,以及作为验证路径,确保
browser-record
搭配
browser-selectors
生成的内容可被重放。
该技能是v0.2.0架构的核心假设。 ADR-0001验证第4节要求,在10个具有不同漂移特征的站点上实现≥80%的重放成功率,提案才能从
Proposed
(提议)状态转为
Accepted
(已接受)状态。如果发现重放不可靠,请在
findings.md
中记录失败模式并上报至ADR。

When to use

使用场景

  • Regression-testing a UI flow after a deploy.
  • Reproducing a bug captured in a prior session.
  • Comparing two runs of the same flow for
    browser-screenshot-diff
    .
  • Forking a session (
    /ruflo-browser fork
    ) and replaying the parent before mutating.
  • 部署后对UI流程进行回归测试。
  • 复现先前会话中捕获的Bug。
  • 对比同一流程的两次运行结果,用于
    browser-screenshot-diff
  • 分叉会话(
    /ruflo-browser fork
    )并在修改前重放父会话。

Steps

操作步骤

  1. Locate the source session:
    bash
    npx -y ruvector@0.2.25 rvf status <session-id>.rvf
  2. Load the trajectory:
    bash
    Read .../trajectory.ndjson
    Each line is
    {ts, action, args, selector, result}
    .
  3. Open a fresh browser via
    mcp__claude-flow__browser_open
    (target URL = original or
    --url
    override).
  4. For each trajectory step, dispatch the matching MCP tool (
    browser_click
    ,
    browser_fill
    ,
    browser_eval
    , etc.) with the recorded args.
  5. On selector miss, do not fail immediately — query the
    browser-selectors
    namespace for an embedding-similar selector for the same
    <host>:<intent>
    and retry once:
    bash
    npx -y @claude-flow/cli@latest memory search --namespace browser-selectors \
      --query "<host> <intent>" --limit 5
  6. Record a new trajectory for the replay run (allocate a fresh RVF container, lineage-tracked via
    rvf derive
    ).
  7. Verdict: tally matched-step / total-step ratio. Default tolerance threshold is 0.85 (configurable via
    --tolerance
    ). Verdict goes into
    findings.md
    .
  1. 定位源会话:
    bash
    npx -y ruvector@0.2.25 rvf status <session-id>.rvf
  2. 加载轨迹:
    bash
    Read .../trajectory.ndjson
    每一行格式为
    {ts, action, args, selector, result}
  3. 通过
    mcp__claude-flow__browser_open
    打开新浏览器
    (目标URL为原始URL或通过
    --url
    覆盖)。
  4. 针对每个轨迹步骤,调度匹配的MCP工具(
    browser_click
    browser_fill
    browser_eval
    等)并传入录制的参数。
  5. 当选择器匹配失败时,不要立即终止——查询
    browser-selectors
    命名空间,获取具有相同
    <host>:<intent>
    的嵌入相似度匹配选择器,并重试一次:
    bash
    npx -y @claude-flow/cli@latest memory search --namespace browser-selectors \
      --query "<host> <intent>" --limit 5
  6. 为重放运行录制新轨迹(分配新的RVF容器,通过
    rvf derive
    进行 lineage 追踪)。
  7. 判定结果: 计算匹配步骤数/总步骤数的比率。默认容错阈值为0.85(可通过
    --tolerance
    配置)。判定结果需写入
    findings.md

Caveats

注意事项

  • Browserbase explicitly does not offer replay (rrweb session replay was deprecated). We're betting on selector-embedding recovery; expect noise on heavily drifted sites.
  • Network nondeterminism (timing, content variation) can produce false-fail verdicts. Use
    --mutate
    to inject expected variation or pin to a fixture.
  • For visual diff, chain into
    browser-screenshot-diff
    against the parent session id.
  • If selector recovery requires more than one retry per step, log it. That's the signal that the site needs a re-record, not a replay.
  • Browserbase明确不提供重放功能(rrweb会话重放已被弃用)。我们寄希望于选择器嵌入恢复技术;在DOM漂移严重的站点上可能会出现异常。
  • 网络不确定性(时序、内容变化)可能导致误判。使用
    --mutate
    注入预期变化或固定到测试夹具。
  • 如需视觉对比,可将结果与父会话ID关联到
    browser-screenshot-diff
    工具中。
  • 如果每个步骤的选择器恢复需要超过一次重试,请记录该情况。这表明该站点需要重新录制会话,而非进行重放。