{"record":{"id":"15f85c57252d3de2","repo":"xpzouying/xiaohongshu-mcp","slug":"w-15f85c","errorCode":null,"errorMessage":"无法点击评论输入框: %w","messagePattern":"无法点击评论输入框: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/comment_feed.go","lineNumber":49,"sourceCode":"\t// 导航到详情页\n\tpage.MustNavigate(url)\n\tpage.MustWaitDOMStable()\n\thumanize.Delay(ctx, humanize.AfterNavigate)\n\n\t// 检测页面是否可访问\n\tif err := checkPageAccessible(page); err != nil {\n\t\treturn err\n\t}\n\n\telem, err := page.Element(\"div.input-box div.content-edit span\")\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to find comment input box: %v\", err)\n\t\treturn fmt.Errorf(\"未找到评论输入框，该帖子可能不支持评论或网页端不可访问: %w\", err)\n\t}\n\n\tif err := humanize.Click(elem); err != nil {\n\t\tlogrus.Warnf(\"Failed to click comment input box: %v\", err)\n\t\treturn fmt.Errorf(\"无法点击评论输入框: %w\", err)\n\t}\n\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 {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/comment_feed.go#L31-L67","documentation":"After finding the comment box, PostComment clicks it via humanize.Click to focus the editor. If the click fails (element detached, intercepted by overlay, page navigating), this wrapped error is returned.","triggerScenarios":"humanize.Click on the comment input span fails because the page navigated/reloaded, a modal/login popup covers the element, or the element became stale between lookup and click.","commonSituations":"Slow networks where the page is still hydrating; login-expired popups stealing the click; anti-bot overlays; rapid successive calls reusing a closing page.","solutions":["Retry the whole PostComment operation once after a short delay","Ensure the page is fully loaded/idle before calling PostComment (wait for network idle)","Re-authenticate if a login modal is intercepting clicks","Extend humanize/page timeouts if the environment is slow"],"exampleFix":"// before\n_ = svc.PostComment(ctx, feedID, content) // no retry\n// after\nerr := svc.PostComment(ctx, feedID, content)\nif err != nil { time.Sleep(3 * time.Second); err = svc.PostComment(ctx, feedID, content) }","handlingStrategy":"retry","validationCode":"// 确保页面加载完成再评论\npage.MustWaitStable() // 或等待网络空闲，避免元素仍在渲染","typeGuard":null,"tryCatchPattern":"var err error\nfor i := 0; i < 2; i++ {\n    if err = svc.PostComment(ctx, feedID, content); err == nil || !strings.Contains(err.Error(), \"无法点击\") {\n        break\n    }\n    time.Sleep(3 * time.Second)\n}","preventionTips":["点击前等待页面稳定/网络空闲","处理并关闭登录弹窗、广告遮罩","避免高频并发调用同一页面"],"tags":["click","dom","interaction","go-rod","comment"],"backgroundTag":"element-click-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"}