{"record":{"id":"2ce94dd7436c0daa","repo":"xpzouying/xiaohongshu-mcp","slug":"error-2ce94d","errorCode":null,"errorMessage":"声明原创按钮仍处于禁用状态","messagePattern":"声明原创按钮仍处于禁用状态","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/publish.go","lineNumber":1064,"sourceCode":"\n\tfooter, err := findFooterByText(page, \"声明原创\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"未找到声明原创弹窗\")\n\t}\n\n\tbtn, err := footer.Element(\"button.custom-button\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"未找到声明原创按钮\")\n\t}\n\n\tif isButtonDisabled(btn) {\n\t\t// 兜底：按钮仍禁用，可能须知未勾上，再勾一次\n\t\tif err := checkFooterCheckbox(footer); err != nil {\n\t\t\tslog.Warn(\"二次勾选须知失败\", \"error\", err)\n\t\t}\n\t\ttime.Sleep(300 * time.Millisecond)\n\t\tif isButtonDisabled(btn) {\n\t\t\treturn errors.New(\"声明原创按钮仍处于禁用状态\")\n\t\t}\n\t}\n\n\tif err := humanize.Click(btn); err != nil {\n\t\treturn errors.Wrap(err, \"点击声明原创按钮失败\")\n\t}\n\tslog.Info(\"已成功点击声明原创按钮\")\n\ttime.Sleep(300 * time.Millisecond)\n\treturn nil\n}\n\nfunc findFooterByText(page *rod.Page, keyword string) (*rod.Element, error) {\n\tfooters, err := page.Elements(\"div.footer\")\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"查找弹窗 footer 失败\")\n\t}\n\tfor _, footer := range footers {\n\t\ttext, err := footer.Text()","sourceCodeStart":1046,"sourceCodeEnd":1082,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L1046-L1082","documentation":"After enabling the original-declaration switch, XHS shows a confirmation dialog requiring the user to check a notice checkbox before the '声明原创' button becomes clickable. confirmOriginalDeclaration retries checking the footer checkbox once and, if isButtonDisabled(btn) still reports the button disabled, throws this error. It means the declaration could not be confirmed interactively.","triggerScenarios":"setOriginal → confirmOriginalDeclaration; the notice checkbox check didn't register (custom checkbox needing real mouse events, wrong element clicked) so the confirm button's disabled state never cleared even after the second attempt.","commonSituations":"Checkbox is a styled div whose click target is an inner span, so synthetic clicks miss it; confirm dialog rendered in an overlay/iframe the code didn't account for; animation/transition swallowed the first click; XHS redesigning the dialog markup.","solutions":["Inspect the dialog DOM and ensure checkFooterCheckbox clicks the actual hit target (inner input/label) of the custom checkbox","Increase the post-check sleep or use rod's WaitDisabled/WaitEnabled on the button instead of fixed sleeps","Use humanize/real-mouse click for the checkbox as well, not just for the confirm button","Capture a screenshot on failure to see whether the dialog state differs (e.g. additional agreement items required)"],"exampleFix":"// before\nif isButtonDisabled(btn) {\n\treturn errors.New(\"声明原创按钮仍处于禁用状态\")\n}\n// after\nif err := btn.WaitEnabled(5 * time.Second); err != nil {\n\treturn errors.Wrap(err, \"声明原创按钮仍处于禁用状态\")\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := confirmOriginalDeclaration(page); err != nil {\n\tif strings.Contains(err.Error(), \"仍处于禁用状态\") {\n\t\ttime.Sleep(1 * time.Second)\n\t\treturn confirmOriginalDeclaration(page) // 重试一次勾选+确认\n\t}\n\treturn err\n}","preventionTips":["Click the real hit target of the custom checkbox (input/label), not its styled wrapper","Replace fixed sleeps with rod WaitEnabled on the confirm button","Screenshot the dialog on failure to check for extra required agreements","Re-verify dialog selectors after XHS dialog redesigns"],"tags":["dom","custom-checkbox","ui-dialog","xiaohongshu"],"backgroundTag":"confirm-button-still-disabled","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}