You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chajia/docs/rpa-mothership-logged-in-so...

4.4 KiB

MotherShip 登录后查价录制 SOP(Step 12.61)

匿名 widget 仍走 npm run record:mothership(GD-15)。
本文件仅覆盖:客户配置账密后的登录态查价路径。

前置

  1. .env 已填 MOTHERSHIP_EMAIL / MOTHERSHIP_PASSWORD(勿提交真实密码)
  2. 本机已装 Playwright Chromium/Chrome;RPA_BROWSER_CHANNEL=chrome 推荐
  3. 关闭会干扰 codegen 的自动填密插件(或全程手动粘贴)

启动

npm run record:mothership -- --logged-in
# 或指定入口(允许 dashboard / login)
npm run record:mothership -- --logged-in https://dashboard.mothership.com/

Windows:

powershell -ExecutionPolicy Bypass -File scripts/record-mothership.ps1 -LoggedIn

产物约定:

类型 路径
codegen 脚本 .rpa/recordings/mothership-logged-in-<时间戳>.js
storageState .rpa/mothership-logged-in-storage.json

与匿名 .rpa/mothership-storage.json 隔离,禁止混用。

人工路径(必须完整一次)

标准样例:Pickup Los Angeles / 90001 → Delivery Dallas / 75201;单托 500 lb、48×40×48 in、托盘数 2(或登录后表单等价字段)。

  1. codegen 浏览器打开登录页(若未登录)
  2. 手动粘贴邮箱/密码并提交(脚本不自动填)
  3. 进入登录后查价入口(记录最终 URL)
  4. 按页面真实字段走完:地址/货物/提交 → 等到报价结果出现
  5. 关闭 codegen 窗口,确认 js + storage 落盘

录制后必填清单(从 js 摘抄)

将下列项填入下方「附录 A」;正式写入 .env 的 RPA_SELECTOR_MS_* 可与下一步 RPA 适配同做。

# 项 说明
1 登录页 URL 含 /login 或实际登录入口
2 登录后报价入口 URL 出表单的首个稳定 URL
3 RPA_SELECTOR_LOGIN_EMAIL email 输入
4 RPA_SELECTOR_LOGIN_PASSWORD password 输入
5 RPA_SELECTOR_LOGIN_SUBMIT 登录提交
6 表单可见标记 heading / 关键文案(供 isLoggedInQuoteForm)
7 提货/派送地址字段 selector
8 货物字段 selector 托盘/重量/尺寸或登录后等价项
9 提交报价 selector
10 出报价特征 网络 URL 模式或结果 DOM 文案

禁止

  • 匿名模式录制登录后页(GD-15 会拦 dashboard)
  • 用手猜 selector 跳过本 SOP
  • 把登录态 storage 写进匿名 RPA_STORAGE_STATE_PATH

附录 A — 本次录制摘抄(人工回填)

2026-07-15:登录 + 「Create a new shipment」一级表单已录制(mothership-logged-in-20260715-105824.js)。
警告:录制脚本含明文账密,仅存 .rpa/(gitignore),勿提交、勿写进文档。

项 值
录制脚本文件 .rpa/recordings/mothership-logged-in-20260715-105824.js
登录页 URL https://dashboard.mothership.com/login
登录后报价入口 URL https://dashboard.mothership.com/ship(直达;亦可 dashboard → Ship → Create a new shipment)
LOGIN_EMAIL getByTestId('auth-email-input')
LOGIN_PASSWORD getByTestId('auth-password-input')
LOGIN_SUBMIT getByTestId('auth-log-in-button')
表单可见标记 文案 Create a new shipment / 中文 UI「创建新货件」
地址字段 quote-create-pickup-input-search / quote-create-delivery-input-search
附加服务 address-book-accessorials-trigger + address-book-accessorials-option-*
货物字段 cargo-type-dropdown-input / cargo-quantity-input / cargo-weight-input / cargo-length|width|height-input
提交钮 ship-create-continue-button(一级「继续」)
出报价特征 rate-card / quote-details-rate-option-*(二级,后续)
录制日期 2026-07-15
系统 UI Step 12.62 MothershipLoggedInShipmentForm(有账密或 ?ms_logged_in=1)

刷价驻留(Step 12.168)

  • 首价成功后 Worker 须 parkQuoteSession(需 RPA_WORKER_ID),禁止 spawn 断会话
  • 嵌入弹窗 60s:继续填写 / 不继续;超时=不继续并 release
  • 继续后提交二级 → ms-refine-details job → Save&update → 再刮价;总硬限 5 分钟
  • 探针:npx tsx scripts/probe-ms-refine-hold.ts(自设 RPA_WORKER_ID;首价 park TTL=5min)
  • 结账探针保障:PROBE_MS_COVERAGE=freight_protect|basic + PROBE_MS_CARGO_VALUE=5000;PROBE_MS_CARRIER 指定承运商