{"record":{"id":"eb97c46152cc8f26","repo":"jackwener/OpenCLI","slug":"labels-0-tmp-wec","errorCode":null,"errorMessage":"找不到\"${labels[0]}\"按钮（按钮可能被禁用或表单未完成），截图已保存到 /tmp/wechat-channels_publish_submit_debug.png","messagePattern":"找不到\"(.+?)\"按钮（按钮可能被禁用或表单未完成），截图已保存到 /tmp/wechat-channels_publish_submit_debug\\.png","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/wechat-channels/publish.js","lineNumber":548,"sourceCode":"        var text = (btn.innerText || btn.textContent || '').trim();\n        var isDisabled = btn.disabled || btn.getAttribute('disabled') !== null ||\n                         btn.classList.contains('weui-desktop-btn_disabled');\n        if (!isDisabled && isVisible(btn)) {\n          for (var j = 0; j < labels.length; j++) {\n            if (text === labels[j] || text.includes(labels[j])) {\n              btn.click();\n              return { ok: true, text: text };\n            }\n          }\n        }\n      }\n      return { ok: false };\n    })(${JSON.stringify(labels)})\n  `);\n\n  if (!clicked?.ok) {\n    await page.screenshot({ path: '/tmp/wechat-channels_publish_submit_debug.png' });\n    throw new CommandExecutionError(\n      `找不到\"${labels[0]}\"按钮（按钮可能被禁用或表单未完成），` +\n      '截图已保存到 /tmp/wechat-channels_publish_submit_debug.png'\n    );\n  }\n  return clicked;\n}\n\n// ── Main cli registration ──────────────────────────────────────────────────\ncli({\n  site: 'wechat-channels',\n  name: 'publish',\n  access: 'write',\n  description: '发布视频到视频号',\n  domain: 'channels.weixin.qq.com',\n  strategy: Strategy.COOKIE,\n  browser: true,\n  navigateBefore: false,\n  args: [","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/wechat-channels/publish.js#L530-L566","documentation":"clickPublish clicks either the publish or save-draft button on the WeChat Channels page. If the in-page script cannot find a clickable button matching the known labels, it returns {ok:false} and this CommandExecutionError is thrown after saving a screenshot to /tmp/wechat-channels_publish_submit_debug.png.","triggerScenarios":"None of the candidate button labels matched a visible, enabled button; the button exists but is disabled because required form fields (video, title, cover) are incomplete or still uploading/processing.","commonSituations":"Video still transcoding so publish button remains disabled; missing mandatory fields like cover or category; WeChat renamed the button (e.g. changed 发表 label); using --draft when the draft button is hidden behind a dropdown menu.","solutions":["Open /tmp/wechat-channels_publish_submit_debug.png to inspect the form state","Ensure all required fields are complete and the video finished uploading/transcoding before clicking publish","Wait for the button to become enabled (poll for non-disabled state) instead of clicking immediately","Update the labels array in clickPublish to include any renamed button text","Use --manual plus persistent session to submit by hand if automation cannot find the button"],"exampleFix":"// before\nawait page.evaluate(`(function(labels){ ...click... })(${JSON.stringify(labels)})`);\n// after\nawait page.waitForFunction(`(labels) => labels.some(t => [...document.querySelectorAll('button')].some(b => b.innerText.includes(t) && !b.disabled))`, { args: [labels], timeout: 30000 });\nconst clicked = await page.evaluate(`(function(labels){ ...click... })(${JSON.stringify(labels)})`);","handlingStrategy":"validation","validationCode":"// before submitting, assert required form fields are complete\nconst ready = await page.evaluate(() => {\n  const btns = [...document.querySelectorAll('button')];\n  return btns.some(b => !b.disabled && /发表|保存草稿/.test(b.innerText));\n});\nif (!ready) throw new Error('Publish/draft button not ready — complete the form and wait for upload to finish');","typeGuard":null,"tryCatchPattern":"try {\n  await clickPublish(page, isDraft);\n} catch (e) {\n  if (/找不到.*按钮/.test(e.message)) {\n    console.error('Submit button missing/disabled; see /tmp/wechat-channels_publish_submit_debug.png');\n  } else throw e;\n}","preventionTips":["Wait for video upload/transcode to complete before clicking publish","Fill all required fields (title, cover, category) first","Poll for the button to become enabled instead of clicking immediately","Keep the button label list current with site changes"],"tags":["wechat-channels","button-click","browser-automation"],"backgroundTag":"publish-button-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}