{"record":{"id":"1416f4273c7115f3","repo":"xpzouying/xiaohongshu-mcp","slug":"error-1416f4","errorCode":null,"errorMessage":"查找标题输入框失败","messagePattern":"查找标题输入框失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/publish_video.go","lineNumber":108,"sourceCode":"\t}\n\n\tfileInput.MustSetFiles(videoPath)\n\n\t// 对于视频，等待发布按钮变为可点击即表示处理完成\n\tbtn, err := waitForPublishButtonClickable(pp, 10*time.Minute)\n\tif err != nil {\n\t\treturn err\n\t}\n\tslog.Info(\"视频上传/处理完成，发布按钮可点击\", \"btn\", btn)\n\treturn nil\n}\n\n// submitPublishVideo 填写标题、正文、标签并点击发布（等待按钮可点击后再提交）\nfunc submitPublishVideo(ctx context.Context, page *rod.Page, title, content string, tags []string, scheduleTime *time.Time, visibility string, products []string) error {\n\t// 标题\n\ttitleElem, err := page.Element(\"div.d-input input\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"查找标题输入框失败\")\n\t}\n\tif err := humanize.Type(ctx, titleElem, title); err != nil {\n\t\treturn errors.Wrap(err, \"输入标题失败\")\n\t}\n\thumanize.Delay(ctx, humanize.AfterType)\n\n\t// 正文 + 标签\n\tcontentElem, err := getContentElement(page, contentElemTimeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := humanize.Type(ctx, contentElem, content); err != nil {\n\t\treturn errors.Wrap(err, \"输入正文失败\")\n\t}\n\tif err := waitAndClickTitleInput(titleElem); err != nil {\n\t\treturn err\n\t}\n\tif err := inputTags(ctx, contentElem, tags); err != nil {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish_video.go#L90-L126","documentation":"submitPublishVideo looks up the title input with the CSS selector div.d-input input; if rod cannot find it within the page timeout, the error is wrapped as \"查找标题输入框失败\". This indicates the publish page DOM is not in the expected state when the form-fill starts.","triggerScenarios":"page.Element(\"div.d-input input\") times out because the title field has not rendered yet, the page shows an error/captcha/login dialog instead of the editor, or the site markup changed.","commonSituations":"Xiaohongshu frontend update renaming the d-input class; network slowness so the editor renders after the default element timeout; session expired and the page redirected to login; video still processing so the form section is hidden.","solutions":["Increase the page timeout (page.Timeout(...)) before element lookup on slow networks","Verify the session is valid — re-login and refresh cookies if redirected to a login page","Wait for the editor to be ready (e.g. wait for the video upload to finish / WaitDOMStable) before calling PublishVideo","Inspect the live page and update the div.d-input input selector to match current markup"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-check the page is on the publish editor before filling\nif err := page.WaitElements(\"div.d-input input\"); err != nil {\n    return fmt.Errorf(\"editor not ready: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"var titleElem *rod.Element\nerr := rod.Try(func() { titleElem = page.Timeout(30*time.Second).MustElement(\"div.d-input input\") })\nif err != nil {\n    // retry once after reload, then surface\n}","preventionTips":["Wait for DOM stability / editor readiness before form fill","Increase element timeouts on slow networks","Detect login redirects early and re-authenticate","Pin and periodically re-verify selectors against the live site"],"tags":["browser-automation","selector","go","timeout"],"backgroundTag":"page-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"}