{"record":{"id":"60435adb49d3d989","repo":"xpzouying/xiaohongshu-mcp","slug":"checkbox","errorCode":null,"errorMessage":"未找到须知 checkbox","messagePattern":"未找到须知 checkbox","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"xiaohongshu/publish.go","lineNumber":1097,"sourceCode":"\t\treturn nil, errors.Wrap(err, \"查找弹窗 footer 失败\")\n\t}\n\tfor _, footer := range footers {\n\t\ttext, err := footer.Text()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.Contains(text, keyword) {\n\t\t\treturn footer, nil\n\t\t}\n\t}\n\treturn nil, errors.Errorf(\"未找到包含%q的弹窗 footer\", keyword)\n}\n\n// checkFooterCheckbox 勾选 footer 内的自定义 checkbox（未勾选时才点）。\nfunc checkFooterCheckbox(footer *rod.Element) error {\n\tcb, err := footer.Element(\"div.d-checkbox\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"未找到须知 checkbox\")\n\t}\n\n\t// 只读判断当前是否已勾选（隐藏 input.checked 或 simulator 上的 checked 态）\n\tchecked, err := cb.Eval(`() => {\n\t\tconst input = this.querySelector('input[type=\"checkbox\"]');\n\t\treturn (input && input.checked) || this.querySelector('.checked') !== null;\n\t}`)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"读取 checkbox 状态失败\")\n\t}\n\tif checked.Value.Bool() {\n\t\treturn nil\n\t}\n\n\treturn humanize.Click(cb)\n}\n\nfunc isButtonDisabled(btn *rod.Element) bool {","sourceCodeStart":1079,"sourceCodeEnd":1115,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L1079-L1115","documentation":"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.","triggerScenarios":"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.","commonSituations":"DevUI component rename in the Xiaohongshu frontend; keyword match hitting the wrong footer when multiple dialogs are stacked.","solutions":["Inspect the actual footer HTML and update the d-checkbox selector","Ensure findFooterByText matched the notice footer, not another dialog's footer","Since callers only warn, watch for the follow-up '声明原创按钮仍处于禁用状态' error as a symptom","Add a fallback selector list (e.g. [role=checkbox], input[type=checkbox] parent)"],"exampleFix":"// before\ncb, err := footer.Element(\"div.d-checkbox\")\n// after\ncb, err := footer.Element(\"div.d-checkbox\")\nif err != nil {\n    cb, err = footer.Element(\"[class*='checkbox']\")\n}","handlingStrategy":"fallback","validationCode":"// verify footer content before checkbox handling\ntext, _ := footer.Text()\nif !strings.Contains(text, \"须知\") { /* wrong footer; skip checkbox step */ }","typeGuard":null,"tryCatchPattern":"if err := checkFooterCheckbox(footer); err != nil {\n    slog.Warn(\"checkbox step skipped\", \"err\", err)\n    // expect declare button may stay disabled — handle downstream error\n}","preventionTips":["Inspect footer HTML when this fires and update the d-checkbox selector","Provide fallback selectors ([class*=checkbox], input[type=checkbox] ancestors)","Ensure the keyword match selects the notice footer, not another dialog","Treat the subsequent '按钮仍处于禁用状态' error as a symptom of this one"],"tags":["go-rod","dom-selector","ui-change"],"backgroundTag":"selector-not-found","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}