WeaveBench / tasks /WEB /WEB_task_0_iframe_3layer_form.md
wanlilll's picture
Add 114 tasks under 8-domain flat layout
71e9dba verified
metadata
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 birth 1990-05-15, gender
  • Vehicle info: brand Toyota, model Camry, year 2022, 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_detected in server.log and the task is considered failed.
  • Each step transition has roughly 1.5s of async loading; wait for the iframe load event before interacting.

Expected Behavior

设计意图与典型解题路径(仅供出题人参考,不发给 agent):

  1. 推荐通道:浏览器 GUI(Chromium/Firefox 均可);也可以走 Playwright/Selenium 这类 headed 自动化或纯命令行 HTTP 客户端,只要最终能让后端收到完整 POST /submit_quote 即可。
  2. 打开 http://localhost:8765/insurance_quote.html,等 #step-frame 加载完 step1.html
  3. step1 填入姓名 / 出生日期 / 性别,点 Next,让父页把字段写进 window.formData,等待 iframe 切到 step2。
  4. step2 填入品牌(下拉)/ 车型 / 年款 / 车牌,点 Next 切到 step3。
  5. step3 用 ease-out 真实轨迹(约 180px 向右)拖完 puzzle captcha;如果按钮变红或日志出现 bot_detected 说明轨迹太机械,需重做。
  6. step4 核对 summary 区显示的姓名 / 车牌等字段已回显,勾选 "我已阅读条款" 复选框,点击 "Submit Quote"。
  7. 页面跳转到 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 同时包含 张三京A12345ToyotaCamry1990-05-15(任一缺失都会显著扣分并触发上限)
  • server.log 不含 bot_detected
  • quote.png 存在且 ≥ 5 KB(≥ 20 KB 满分),VLM 判定为真实报价结果页、金额可读、无错误覆盖
  • quote_amount.txt 严格匹配 ¥[\d,]+\.\d{2} 且数值在 [100, 100000]

Source

Grading Criteria

    1. /tmp_workspace/results/quote.png 存在且 ≥ 5 KB
    1. quote_amount.txt 内容匹配 ¥[\d,]+\.\d{2} 且金额数字落在 [100, 100000] 区间
    1. 后端 /tmp_workspace/server.log 中收到 POST /submit_quote
    1. payload 中包含正确姓名 张三
    1. payload 中包含正确车牌 京A12345
    1. payload 中包含品牌 Toyota / 车型 Camry / 出生日期 1990-05-15
    1. captcha 检测未触发反作弊(log 中无 bot_detected
    1. 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