jackwener/OpenCLI · error · CommandExecutionError

找不到"${labels[0]}"按钮(按钮可能被禁用或表单未完成),截图已保存到 /tmp/wechat-channe

Error message

找不到"${labels[0]}"按钮(按钮可能被禁用或表单未完成),截图已保存到 /tmp/wechat-channels_publish_submit_debug.png

What it means

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.

Source

Thrown at clis/wechat-channels/publish.js:548

        var text = (btn.innerText || btn.textContent || '').trim();
        var isDisabled = btn.disabled || btn.getAttribute('disabled') !== null ||
                         btn.classList.contains('weui-desktop-btn_disabled');
        if (!isDisabled && isVisible(btn)) {
          for (var j = 0; j < labels.length; j++) {
            if (text === labels[j] || text.includes(labels[j])) {
              btn.click();
              return { ok: true, text: text };
            }
          }
        }
      }
      return { ok: false };
    })(${JSON.stringify(labels)})
  `);

  if (!clicked?.ok) {
    await page.screenshot({ path: '/tmp/wechat-channels_publish_submit_debug.png' });
    throw new CommandExecutionError(
      `找不到"${labels[0]}"按钮(按钮可能被禁用或表单未完成),` +
      '截图已保存到 /tmp/wechat-channels_publish_submit_debug.png'
    );
  }
  return clicked;
}

// ── Main cli registration ──────────────────────────────────────────────────
cli({
  site: 'wechat-channels',
  name: 'publish',
  access: 'write',
  description: '发布视频到视频号',
  domain: 'channels.weixin.qq.com',
  strategy: Strategy.COOKIE,
  browser: true,
  navigateBefore: false,
  args: [

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open /tmp/wechat-channels_publish_submit_debug.png to inspect the form state
  2. Ensure all required fields are complete and the video finished uploading/transcoding before clicking publish
  3. Wait for the button to become enabled (poll for non-disabled state) instead of clicking immediately
  4. Update the labels array in clickPublish to include any renamed button text
  5. Use --manual plus persistent session to submit by hand if automation cannot find the button

Example fix

// before
await page.evaluate(`(function(labels){ ...click... })(${JSON.stringify(labels)})`);
// after
await page.waitForFunction(`(labels) => labels.some(t => [...document.querySelectorAll('button')].some(b => b.innerText.includes(t) && !b.disabled))`, { args: [labels], timeout: 30000 });
const clicked = await page.evaluate(`(function(labels){ ...click... })(${JSON.stringify(labels)})`);
Defensive patterns

Strategy: validation

Validate before calling

// before submitting, assert required form fields are complete
const ready = await page.evaluate(() => {
  const btns = [...document.querySelectorAll('button')];
  return btns.some(b => !b.disabled && /发表|保存草稿/.test(b.innerText));
});
if (!ready) throw new Error('Publish/draft button not ready — complete the form and wait for upload to finish');

Try / catch

try {
  await clickPublish(page, isDraft);
} catch (e) {
  if (/找不到.*按钮/.test(e.message)) {
    console.error('Submit button missing/disabled; see /tmp/wechat-channels_publish_submit_debug.png');
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/eb97c46152cc8f26. Report an issue: GitHub.