{"record":{"id":"2bc7b49d7f777b61","repo":"xpzouying/xiaohongshu-mcp","slug":"submit-disabled","errorCode":null,"errorMessage":"读取新版发布按钮 submit-disabled 属性失败","messagePattern":"读取新版发布按钮 submit-disabled 属性失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"xiaohongshu/publish.go","lineNumber":502,"sourceCode":"\t\treturn nil, \"\", errors.Wrap(err, \"查找新版发布按钮失败\")\n\t}\n\n\tfor _, widget := range widgets {\n\t\tif !isElementVisible(widget) {\n\t\t\tcontinue\n\t\t}\n\n\t\tisPublish, err := widget.Attribute(\"is-publish\")\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"读取新版发布按钮 is-publish 属性失败\")\n\t\t}\n\t\tif isPublish != nil && *isPublish == \"false\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tsubmitDisabled, err := widget.Attribute(\"submit-disabled\")\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"读取新版发布按钮 submit-disabled 属性失败\")\n\t\t}\n\t\tif submitDisabled != nil && *submitDisabled == \"true\" {\n\t\t\treturn &publishButton{elem: widget, isWidget: true}, \"新版发布按钮不可点击\", nil\n\t\t}\n\n\t\treturn &publishButton{elem: widget, isWidget: true}, \"\", nil\n\t}\n\n\toldButtons, err := page.Elements(\".publish-page-publish-btn button.bg-red\")\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrap(err, \"查找旧版发布按钮失败\")\n\t}\n\n\tfor _, oldButton := range oldButtons {\n\t\tif !isElementVisible(oldButton) {\n\t\t\tcontinue\n\t\t}\n","sourceCodeStart":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L484-L520","documentation":"findPublishButton 遍历新版发布按钮 widget 时读取 submit-disabled 属性的 Attribute 调用失败：元素在遍历过程中被重渲染/销毁，CDP 属性查询报错。与按钮被禁用（值判断）不同，这里是读取本身失败。","triggerScenarios":"widget.Attribute(\"submit-disabled\") errors due to a detached element, destroyed execution context, or browser connection failure during the attribute read.","commonSituations":"Element replaced by a re-render mid-inspection; page navigation; resource-constrained browser dropping CDP responses.","solutions":["Transient — the polling loop retries each second; retry the whole publish if it propagates","Reduce concurrent activity on the page during publish","Verify browser health and stability","Update the library if the failure becomes persistent after a Xiaohongshu frontend change"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := xhs.Publish(...)\nif err != nil && strings.Contains(err.Error(), \"submit-disabled 属性失败\") {\n    err = xhs.Publish(...) // 瞬时读取失败，重试\n}","preventionTips":["Avoid heavy page activity during the publish flow","Ensure stable browser connection (CDP)","Retry once on propagation","Update library/rod after frontend changes"],"tags":["browser-automation","rod","element-attribute"],"backgroundTag":"element-attribute-read-failed","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"}