{"record":{"id":"fe70dd6bb8aa3b36","repo":"xpzouying/xiaohongshu-mcp","slug":"error-fe70dd","errorCode":null,"errorMessage":"未找到视频上传输入框","messagePattern":"未找到视频上传输入框","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/publish_video.go","lineNumber":88,"sourceCode":"\treturn nil\n}\n\n// uploadVideo 上传单个本地视频\nfunc uploadVideo(page *rod.Page, videoPath string) error {\n\tpp := page.Timeout(5 * time.Minute) // 视频处理耗时更长\n\n\tif _, err := os.Stat(videoPath); os.IsNotExist(err) {\n\t\treturn errors.Wrapf(err, \"视频文件不存在: %s\", videoPath)\n\t}\n\n\t// 寻找文件上传输入框（与图文一致的 class，或退回到 input[type=file]）\n\tvar fileInput *rod.Element\n\tvar err error\n\tfileInput, err = pp.Element(\".upload-input\")\n\tif err != nil || fileInput == nil {\n\t\tfileInput, err = pp.Element(\"input[type='file']\")\n\t\tif err != nil || fileInput == nil {\n\t\t\treturn errors.New(\"未找到视频上传输入框\")\n\t\t}\n\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\")","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish_video.go#L70-L106","documentation":"uploadVideo 依次尝试 .upload-input 和 input[type='file'] 两个选择器均未找到文件上传输入框：发布页未切换到视频上传 Tab，或页面结构/加载状态异常导致输入框未渲染。","triggerScenarios":"PublishVideo → uploadVideo：发布页未加载完成即查找输入框；小红书前端改版删除/重命名 .upload-input 且页面无其他 file input；被重定向到登录页；页面被风控拦截展示验证码。","commonSituations":"平台 DOM 升级导致选择器失效；页面加载慢，Element 默认超时内未出现上传控件；账号状态异常跳转到非发布页。","solutions":["截图/打印 page HTML 确认当前页面是否为发布页且含 file input","更新 uploadVideo 中的选择器列表以匹配最新 DOM","在上传前先等待关键元素（如发布表单）出现再查找输入框","确认登录态与账号可正常进入视频发布页"],"exampleFix":"// before\nfileInput, err = pp.Element(\"input[type='file']\")\nif err != nil || fileInput == nil {\n\treturn errors.New(\"未找到视频上传输入框\")\n}\n// after\nfileInput, err = pp.Element(\"input[type='file']\")\nif err != nil || fileInput == nil {\n\thtml, _ := pp.HTML()\n\treturn fmt.Errorf(\"未找到视频上传输入框, url=%s\", pp.MustInfo().URL)\n}","handlingStrategy":"try-catch","validationCode":"// 上传前确认当前页面为发布页\nu := page.MustInfo().URL\nif !strings.Contains(u, \"publish\") { return fmt.Errorf(\"当前不在发布页: %s\", u) }","typeGuard":null,"tryCatchPattern":"if err := action.PublishVideo(ctx, content); err != nil {\n\tif strings.Contains(err.Error(), \"未找到视频上传输入框\") {\n\t\tpage.MustScreenshot(\"upload-input-missing.png\")\n\t}\n\treturn err\n}","preventionTips":["定期核对发布页 DOM，及时更新 .upload-input / input[type='file'] 选择器","上传前等待页面关键元素加载完成","登录态失效时先重新登录再进入发布页"],"tags":["selector","ui-automation","upload","xiaohongshu"],"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-14T00:17:10.932Z"}