{"record":{"id":"4e336ee419084661","repo":"xpzouying/xiaohongshu-mcp","slug":"w-4e336e","errorCode":null,"errorMessage":"未找到评论输入区域: %w","messagePattern":"未找到评论输入区域: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/comment_feed.go","lineNumber":56,"sourceCode":"\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 {\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)","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/comment_feed.go#L38-L74","documentation":"After clicking, PostComment waits for the actual text input 'div.input-box div.content-edit p.content-input' to appear. If this element is missing, the editor did not open as expected and this wrapped error is returned.","triggerScenarios":"The click focused nothing (editor never opened), the editor markup differs (new XHS UI uses a different tag/class), or the comment box is visually present but disabled for the account.","commonSituations":"DOM changes from XHS frontend releases; account in a restricted state where typing is blocked; clicking the wrong element because the selector matched a decorative span.","solutions":["Inspect the live editor DOM and update the p.content-input selector to match current markup","Confirm the account can comment manually in a browser (no shadowban/restriction)","Wait for the editor element with a timeout before typing instead of querying immediately"],"exampleFix":"// before\nelem2, err := page.Element(\"div.input-box div.content-edit p.content-input\")\n// after\nelem2, err := page.Element(\"div.input-box div.content-edit p.content-input\", rod.El{ \"timeout\": 5 * time.Second }) // give editor time to render / update selector per live DOM","handlingStrategy":"try-catch","validationCode":"// 先确认编辑器元素存在且可见再操作（若库允许注入等待逻辑）\npage.MustElement(\"div.input-box div.content-edit p.content-input\")","typeGuard":null,"tryCatchPattern":"err := svc.PostComment(ctx, feedID, content)\nif err != nil && strings.Contains(err.Error(), \"未找到评论输入区域\") {\n    // 多为 DOM 变更或账号受限，人工核对页面后更新选择器或换号\n    log.Warnf(\"评论输入区未找到: %v\", err)\n}","preventionTips":["改版后用真实浏览器核对编辑器 DOM 结构","确认账号未被限流/禁评","先点击展开编辑器再查找输入节点"],"tags":["selector","dom","comment","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"}