{"record":{"id":"244301f9fb8f0336","repo":"xpzouying/xiaohongshu-mcp","slug":"w-244301","errorCode":null,"errorMessage":"未找到提交按钮: %w","messagePattern":"未找到提交按钮: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/comment_feed.go","lineNumber":69,"sourceCode":"\thumanize.Delay(ctx, humanize.AfterClick)\n\n\telem2, err := page.Element(\"div.input-box div.content-edit p.content-input\")\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to find comment input field: %v\", err)\n\t\treturn fmt.Errorf(\"未找到评论输入区域: %w\", err)\n\t}\n\n\tif err := humanize.Type(ctx, elem2, content); err != nil {\n\t\tlogrus.Warnf(\"Failed to input comment content: %v\", err)\n\t\treturn fmt.Errorf(\"无法输入评论内容: %w\", err)\n\t}\n\n\thumanize.Delay(ctx, humanize.AfterType)\n\n\tsubmitButton, err := page.Element(\"div.bottom button.submit\")\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to find submit button: %v\", err)\n\t\treturn fmt.Errorf(\"未找到提交按钮: %w\", err)\n\t}\n\n\tif err := humanize.Click(submitButton); err != nil {\n\t\tlogrus.Warnf(\"Failed to click submit button: %v\", err)\n\t\treturn fmt.Errorf(\"无法点击提交按钮: %w\", err)\n\t}\n\n\thumanize.Delay(ctx, humanize.AfterClick)\n\n\t// 就地校验：提交后评论应在评论区渲染出现；未出现则判定失败，避免假成功。\n\tif !waitCommentRendered(page, content, 4*time.Second) {\n\t\tlogrus.Warnf(\"评论提交后未在评论区渲染，判定未成功: feed=%s\", feedID)\n\t\treturn fmt.Errorf(\"评论未确认成功：提交后未在评论区出现（可能账号被限制或发送失败），feed: %s\", feedID)\n\t}\n\n\tlogrus.Infof(\"Comment posted and verified to feed: %s\", feedID)\n\treturn nil\n}","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/comment_feed.go#L51-L87","documentation":"PostComment 评论内容输入完成后，用 div.bottom button.submit 选择器查找提交按钮失败：按钮未渲染（输入校验未通过、内容为空被前端禁用）或页面结构变化。","triggerScenarios":"The submit button is absent because the editor closed, the XHS UI renamed/removed button.submit, or the page rendered an alternate layout (mobile/AB test) without that class.","commonSituations":"XHS frontend redesign changing button classes; editor auto-collapsed after typing due to lost focus; account-restricted state hiding the submit control; half-loaded page.","solutions":["Inspect live DOM and update the 'div.bottom button.submit' selector to current markup","Ensure the editor still has focus before looking for the submit button","Wait for the button element with a timeout instead of immediate query","Verify account/comment permissions in a normal browser session"],"exampleFix":"// before\nsubmitButton, err := page.Element(\"div.bottom button.submit\")\n// after\nsubmitButton, err := page.Element(\"div.bottom button.submit\", rod.El{\"timeout\": 5 * time.Second}) // and confirm selector against current DOM","handlingStrategy":"try-catch","validationCode":"// 提交前确认按钮存在于当前 DOM（页面稳定后）\npage.MustWaitStable()\n_ = page.MustElement(\"div.bottom button.submit\")","typeGuard":null,"tryCatchPattern":"err := svc.PostComment(ctx, feedID, content)\nif err != nil && strings.Contains(err.Error(), \"未找到提交按钮\") {\n    // 检查是否改版/编辑器收起，人工核对后更新选择器\n    log.Warnf(\"提交按钮未找到: %v\", err)\n}","preventionTips":["改版后同步更新 button.submit 选择器","输入后保持编辑器焦点不丢失","等待页面稳定后再进入提交流程"],"tags":["selector","dom","submit","xiaohongshu","go-rod"],"backgroundTag":"element-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"}