id: WEB_task_0_iframe_3layer_form
name: iframe 中的多步表单填写
category: WEB
timeout_seconds: 1200
Prompt
Background: the local URL http://localhost:8765/insurance_quote.html hosts a multi-step insurance-quote form demo (mimicking a real insurance SaaS). The top page nests an <iframe id="step-frame"> inside its #wizard container; the same iframe sequentially loads step1.html (personal info) → step2.html (vehicle info) → step3.html (drag-to-verify captcha) → step4.html (confirm & submit). The parent page persists the current step's field values to window.formData via Next/Back buttons before switching; step4 reads everything back from window.parent.formData, POSTs the aggregated payload to the backend /submit_quote, and the backend dynamically computes a quote from the submitted fields and redirects to quote_result.html.
Goal: walk through the full 4-step form and submit it, then save the backend-computed quote to disk as two deliverables (screenshot + amount text). Field values to submit:
- Personal info: name
张三, date of birth1990-05-15, gender男 - Vehicle info: brand
Toyota, modelCamry, year2022, plate京A12345 - Step 3 must complete the puzzle-drag verification; step 4 must check the terms box and then click "Submit Quote"
Required deliverables (under /tmp_workspace/results/)
| File | Requirement |
|---|---|
quote.png |
Full-screen screenshot of quote_result.html after a successful submission. File ≥ 5 KB (≥ 20 KB recommended). The image must clearly show the quote amount (including the ¥ symbol), must be the result page (not an intermediate step), and must not contain any error / anti-bot red banner. |
quote_amount.txt |
A single line of plain text strictly matching ¥<integer>.<two-decimals> (e.g. ¥2,345.00). The numeric value must fall in [100, 100000]. The amount must come from the real backend response — do not fabricate. |
Anti-cheat and flow constraints
- Step transitions must go through the Next button so the parent page captures the current step's fields; jumping URLs directly bypasses capture and the submission will be missing fields.
- The puzzle drag must simulate a realistic mouse trajectory (with acceleration/deceleration). Teleporting will be flagged as
bot_detectedinserver.logand the task is considered failed. - Each step transition has roughly 1.5s of async loading; wait for the iframe
loadevent before interacting.
Expected Behavior
设计意图与典型解题路径(仅供出题人参考,不发给 agent):
- 推荐通道:浏览器 GUI(Chromium/Firefox 均可);也可以走 Playwright/Selenium 这类 headed 自动化或纯命令行 HTTP 客户端,只要最终能让后端收到完整
POST /submit_quote即可。 - 打开
http://localhost:8765/insurance_quote.html,等#step-frame加载完step1.html。 - step1 填入姓名 / 出生日期 / 性别,点 Next,让父页把字段写进
window.formData,等待 iframe 切到 step2。 - step2 填入品牌(下拉)/ 车型 / 年款 / 车牌,点 Next 切到 step3。
- step3 用 ease-out 真实轨迹(约 180px 向右)拖完 puzzle captcha;如果按钮变红或日志出现
bot_detected说明轨迹太机械,需重做。 - step4 核对 summary 区显示的姓名 / 车牌等字段已回显,勾选 "我已阅读条款" 复选框,点击 "Submit Quote"。
- 页面跳转到
quote_result.html后,对结果页全屏截图 →/tmp_workspace/results/quote.png,把页面显示的金额(形如¥2,345.00)原样写入/tmp_workspace/results/quote_amount.txt。
约束说明:
- iframe 与父页同源但跨 step 重新加载,必须走 Next 按钮触发父页 capture,绕开 UI 直接 POST 会缺字段。
- 反作弊条款:拖拽轨迹需带真实物理特征,否则后端
server.log写入bot_detected,整题判失败。
评分要点(hard gates):
- 后端
server.log中存在POST /submit_quote,且 payload 同时包含张三、京A12345、Toyota、Camry、1990-05-15(任一缺失都会显著扣分并触发上限) server.log不含bot_detectedquote.png存在且 ≥ 5 KB(≥ 20 KB 满分),VLM 判定为真实报价结果页、金额可读、无错误覆盖quote_amount.txt严格匹配¥[\d,]+\.\d{2}且数值在[100, 100000]
Source
- Reddit:https://reddit.com/r/AI_Agents/comments/1rq0xhc/ (Browser tricks 帖)
- 原文引用:"iframe 嵌套层数超过 2 层后基本所有 RPA 工具都会卡住;DnD 必须真实轨迹"
- 对应 benchmark:TXN-15
Grading Criteria
-
/tmp_workspace/results/quote.png存在且 ≥ 5 KB
-
quote_amount.txt内容匹配¥[\d,]+\.\d{2}且金额数字落在 [100, 100000] 区间
-
- 后端
/tmp_workspace/server.log中收到POST /submit_quote
- 后端
-
- payload 中包含正确姓名
张三
- payload 中包含正确姓名
-
- payload 中包含正确车牌
京A12345
- payload 中包含正确车牌
-
- payload 中包含品牌
Toyota/ 车型Camry/ 出生日期1990-05-15
- payload 中包含品牌
-
- captcha 检测未触发反作弊(log 中无
bot_detected)
- captcha 检测未触发反作弊(log 中无
-
- VLM 判定截图为真实的报价结果页(非中间步骤、无错误提示)
Automated Checks
def grade(workspace_path=None, **kwargs) -> dict:
import re
from pathlib import Path
try:
from _judge_helper import vlm_score_rubric
except Exception:
vlm_score_rubric = None
rd = Path("/tmp_workspace/results")
scores = {}
png = rd / "quote.png"
png_size = png.stat().st_size if png.exists() else 0
scores["quote_png"] = 1.0 if png.exists() and png_size >= 5120 else 0.0
scores["quote_png_size_ok"] = 1.0 if png_size >= 20480 else (0.5 if png_size >= 5120 else 0.0)
amt_path = rd / "quote_amount.txt"
amt = amt_path.read_text().strip() if amt_path.exists() else ""
scores["amount_format"] = 1.0 if re.fullmatch(r"¥[\d,]+\.\d{2}", amt) else 0.0
m = re.search(r"¥([\d,]+)\.\d{2}", amt)
try:
amt_val = int(m.group(1).replace(",", "")) if m else 0
except Exception:
amt_val = 0
scores["amount_reasonable"] = 1.0 if 100 <= amt_val <= 100000 else 0.0
log = Path("/tmp_workspace/server.log").read_text() if Path("/tmp_workspace/server.log").exists() else ""
scores["submitted"] = 1.0 if "POST /submit_quote" in log else 0.0
scores["name_ok"] = 1.0 if ("张三" in log or "%E5%BC%A0%E4%B8%89" in log) else 0.0
scores["plate_ok"] = 1.0 if ("京A12345" in log or "%E4%BA%ACA12345" in log) else 0.0
scores["brand_ok"] = 1.0 if "Toyota" in log else 0.0
scores["model_ok"] = 1.0 if "Camry" in log else 0.0
scores["dob_ok"] = 1.0 if "1990-05-15" in log else 0.0
scores["no_bot_flag"] = 0.0 if "bot_detected" in log else 1.0
core_keys = ["submitted", "name_ok", "plate_ok", "brand_ok", "model_ok", "dob_ok", "no_bot_flag"]
aux_keys = ["quote_png", "quote_png_size_ok", "amount_format", "amount_reasonable"]
core = sum(scores[k] for k in core_keys) / len(core_keys)
aux = sum(scores[k] for k in aux_keys) / len(aux_keys)
base = 0.65 * core + 0.35 * aux
if scores["submitted"] < 1.0:
base = min(base, 0.40)
if scores["name_ok"] < 1.0 or scores["plate_ok"] < 1.0:
base = min(base, 0.45)
if scores["quote_png"] < 1.0:
base = min(base, 0.35)
if scores["amount_format"] < 1.0:
base = min(base, 0.55)
if scores["no_bot_flag"] < 1.0:
base = min(base, 0.50)
if vlm_score_rubric and png.exists() and png_size >= 5120:
rubric = {
"vlm_quote_visible": "截图清晰显示报价金额(含 ¥ 符号或数字),且金额数字可读",
"vlm_result_page": "页面是 quote_result.html 风格的报价结果页(不是表单中间步骤)",
"vlm_no_error_overlay": "页面没有错误提示、bot_detected 红条、HTTP 5xx 等异常",
}
vlm = vlm_score_rubric([str(png)], rubric, instruction="评估 iframe 多步表单填写完成后跳转到的报价结果截图。")
for k in rubric: scores[k] = vlm.get(k, 0.0)
scores["judge_method"] = vlm.get("judge_method", "failed")
vlm_avg = sum(vlm.get(k, 0.0) for k in rubric) / len(rubric)
if scores.get("judge_method") == "failed":
overall = min(base, 0.6)
else:
overall = 0.7 * base + 0.3 * vlm_avg
if vlm_avg < 0.5:
overall = min(overall, 0.55)
if vlm_avg < 0.3:
overall = min(overall, 0.40)
scores["overall_score"] = round(overall, 3)
else:
scores["judge_method"] = "no_vlm"
scores["overall_score"] = round(min(base, 0.6), 3)
return scores
Workspace Path
workspace/WEB/task_0_iframe_3layer_form
Skills
Env
Warmup
which chromium-browser >/dev/null 2>&1 || which chromium >/dev/null 2>&1 || apt-get install -y -qq chromium-browser || apt-get install -y -qq chromium || true
mkdir -p /tmp_workspace || true
nohup python3 /tmp_workspace/setup/server.py >/tmp/web_task0_server.log 2>&1 &
sleep 3 || true
curl -sf http://localhost:8765/insurance_quote.html >/dev/null && echo "WEB_task_0 server up" || echo "WEB_task_0 server NOT up"
apt-get install -y -qq tesseract-ocr || true
pip install -q pytesseract pillow numpy || true