{"record":{"id":"a9682247e95935e4","repo":"jackwener/OpenCLI","slug":"fieldname-tmp-wechat-channels-p","errorCode":null,"errorMessage":"找不到 ${fieldName} 输入框，截图已保存到 /tmp/wechat-channels_publish_${fieldName}_debug.png","messagePattern":"找不到 (.+?) 输入框，截图已保存到 /tmp/wechat-channels_publish_(.+?)_debug\\.png","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/wechat-channels/publish.js","lineNumber":370,"sourceCode":"        var nativeSetter = Object.getOwnPropertyDescriptor(proto, 'value') && Object.getOwnPropertyDescriptor(proto, 'value').set;\n        if (nativeSetter) {\n          nativeSetter.call(el, text);\n        } else {\n          el.value = text;\n        }\n        el.dispatchEvent(new InputEvent('input', { bubbles: true, data: text, inputType: 'insertText' }));\n        el.dispatchEvent(new Event('change', { bubbles: true }));\n      }\n\n      var actual = el.isContentEditable ? (el.innerText || el.textContent || '') : (el.value || '');\n      el.blur();\n      return { ok: actual.indexOf(text) >= 0, sel: foundSel, actual: actual };\n    })(${JSON.stringify(selectors)}, ${JSON.stringify(text)})\n  `);\n\n  if (!result?.ok) {\n    await page.screenshot({ path: `/tmp/wechat-channels_publish_${fieldName}_debug.png` });\n    throw new CommandExecutionError(\n      `找不到 ${fieldName} 输入框，截图已保存到 /tmp/wechat-channels_publish_${fieldName}_debug.png`\n    );\n  }\n}\n\n// ── Helper: set schedule time ────────────────────────────────────────────────\nasync function setScheduleTime(page, dt) {\n  // Parse target date\n  const targetYear  = dt.getFullYear();\n  const targetMonth = dt.getMonth() + 1;\n  const targetDay   = dt.getDate();\n  const targetHour  = dt.getHours();\n  const targetMin   = dt.getMinutes();\n  const pad = n => String(n).padStart(2, '0');\n\n  // WeChat Channels uses the WeUI desktop date-time picker (class\n  // `weui-desktop-picker__date-time`). Its real structure (verified against the\n  // live DOM) is NOT a generic calendar:","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/wechat-channels/publish.js#L352-L388","documentation":"fillField runs an in-page script that traverses shadow DOM to find a field among the given selectors, fills it, and verifies the value. If it cannot find/fill/verify, it saves a debug screenshot to /tmp/wechat-channels_publish_<fieldName>_debug.png and throws CommandExecutionError naming the field. This indicates the form field was not reachable in the current page state.","triggerScenarios":"Title (短标题) or description (添加描述) selectors no longer match after a WeChat UI update; the form never rendered because of an expired login or earlier step failure; page still loading when fillField ran.","commonSituations":"WeChat redesigning the creator form; session redirecting to login; contenteditable structure changed; a prior upload failure leaving the form in a state where fields are absent.","solutions":["Inspect /tmp/wechat-channels_publish_<fieldName>_debug.png to see the actual page state.","Confirm login is valid and the create page rendered fully before the fill step.","Retry — transient slow rendering can miss the field; add/rely on wait before filling.","Update TITLE_SELECTORS / DESC_SELECTORS in clis/wechat-channels/publish.js to match the current DOM from the screenshot."],"exampleFix":"// before\nconst TITLE_SELECTORS = ['input[placeholder*=\"短标题\"]'];\n// after (selector observed in debug screenshot)\nconst TITLE_SELECTORS = ['input[placeholder*=\"短标题\"]', 'input.weui-desktop-form__input[placeholder*=\"标题\"]'];","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  await publish({ videoPath, title, description });\n} catch (e) {\n  if (/找不到 .* 输入框/.test(e.message)) {\n    const m = e.message.match(/\\/tmp\\/wechat-channels_publish_(.+)_debug\\.png/);\n    console.error(`Form field missing (${m?.[1]}); inspect screenshot, check login, retry`);\n  }\n  throw e;\n}","preventionTips":["Ensure the session is logged in and the create page fully rendered before publishing.","Review the per-field debug screenshot after any failure.","Re-validate TITLE_SELECTORS / DESC_SELECTORS whenever WeChat updates the creator UI.","Fix earlier step failures (upload) first — they can leave the form without input fields."],"tags":["browser-automation","shadow-dom","selectors"],"backgroundTag":"element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}