xpzouying/xiaohongshu-mcp · warning

未找到须知 checkbox

Error message

未找到须知 checkbox

What it means

checkFooterCheckbox wraps footer.Element("div.d-checkbox") failure with this message. The dialog footer was found but contains no element matching the custom d-checkbox selector — the notice checkbox is missing or its markup changed. Callers treat this as a warning and continue, which can leave the declare button disabled.

Source

Thrown at xiaohongshu/publish.go:1097

		return nil, errors.Wrap(err, "查找弹窗 footer 失败")
	}
	for _, footer := range footers {
		text, err := footer.Text()
		if err != nil {
			continue
		}
		if strings.Contains(text, keyword) {
			return footer, nil
		}
	}
	return nil, errors.Errorf("未找到包含%q的弹窗 footer", keyword)
}

// checkFooterCheckbox 勾选 footer 内的自定义 checkbox(未勾选时才点)。
func checkFooterCheckbox(footer *rod.Element) error {
	cb, err := footer.Element("div.d-checkbox")
	if err != nil {
		return errors.Wrap(err, "未找到须知 checkbox")
	}

	// 只读判断当前是否已勾选(隐藏 input.checked 或 simulator 上的 checked 态)
	checked, err := cb.Eval(`() => {
		const input = this.querySelector('input[type="checkbox"]');
		return (input && input.checked) || this.querySelector('.checked') !== null;
	}`)
	if err != nil {
		return errors.Wrap(err, "读取 checkbox 状态失败")
	}
	if checked.Value.Bool() {
		return nil
	}

	return humanize.Click(cb)
}

func isButtonDisabled(btn *rod.Element) bool {

View on GitHub (pinned to 332d196854)

Solutions

  1. Inspect the actual footer HTML and update the d-checkbox selector
  2. Ensure findFooterByText matched the notice footer, not another dialog's footer
  3. Since callers only warn, watch for the follow-up '声明原创按钮仍处于禁用状态' error as a symptom
  4. Add a fallback selector list (e.g. [role=checkbox], input[type=checkbox] parent)

Example fix

// before
cb, err := footer.Element("div.d-checkbox")
// after
cb, err := footer.Element("div.d-checkbox")
if err != nil {
    cb, err = footer.Element("[class*='checkbox']")
}
Defensive patterns

Strategy: fallback

Validate before calling

// verify footer content before checkbox handling
text, _ := footer.Text()
if !strings.Contains(text, "须知") { /* wrong footer; skip checkbox step */ }

Try / catch

if err := checkFooterCheckbox(footer); err != nil {
    slog.Warn("checkbox step skipped", "err", err)
    // expect declare button may stay disabled — handle downstream error
}

Prevention

When it happens

Trigger: The '原创声明须知' footer exists but its inner checkbox isn't a div.d-checkbox (component library update), or the footer matched by keyword is a different footer without a checkbox.

Common situations: DevUI component rename in the Xiaohongshu frontend; keyword match hitting the wrong footer when multiple dialogs are stacked.

Related errors


AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05). Data as JSON: /api/errors/60435adb49d3d989. Report an issue: GitHub.