jackwener/OpenCLI · error · CommandExecutionError
Could not open compose editor.
Error message
Could not open compose editor.
What it means
Step 3 clicks the 发微博 button via page.evaluate. If the script reports ok:false, the CLI throws CommandExecutionError with the script's message (e.g. 'Could not find 发微博 button'), defaulting to this message when none is present.
Source
Thrown at clis/weibo/publish.js:128
throw new CommandExecutionError('Not logged into Weibo. Please login at weibo.com in your Chrome browser.');
}
// Step 3: Click "发微博" button to open inline compose editor
const clickResult = await page.evaluate(`
() => {
const visible = el => !!el && el.offsetParent !== null && !el.disabled;
const buttons = document.querySelectorAll('button[title="发微博"], button[title="写微博"]');
for (const btn of buttons) {
if (visible(btn)) {
btn.click();
return { ok: true };
}
}
return { ok: false, message: 'Could not find 发微博 button' };
}
`);
if (!clickResult?.ok) {
throw new CommandExecutionError(clickResult?.message ?? 'Could not open compose editor.');
}
// Step 4: Wait for the textarea editor to appear (visible, not just in DOM)
let editorFound = false;
for (let i = 0; i < Math.ceil(COMPOSE_TIMEOUT_MS / COMPOSE_POLL_MS); i++) {
const result = await page.evaluate(`
(selectors => {
// Pick the LAST visible match across all selectors so
// the modal (rendered on top of the home-feed strip)
// wins over earlier matches. See TEXTAREA_SELECTORS.
let last = null;
for (const sel of selectors) {
for (const t of document.querySelectorAll(sel)) {
if (t.offsetParent !== null) last = t;
}
}
if (!last) return { found: false };
return { found: true, visible: true, rectTop: last.getBoundingClientRect().top };View on GitHub (pinned to 49907e53dc)
Solutions
- Retry after a full page load; add settle time if the button hydrates late
- Log in and dismiss any popups/dialogs, then re-run
- Update the library in case selectors were fixed for a Weibo DOM change
- Use the fallback message in the error to identify which selector failed and patch locally
Example fix
// before
weibo publish --text "hi" # button never found
// after
await page.goto('https://weibo.com', { waitUntil: 'load', settleMs: 5000 });
weibo publish --text "hi" Defensive patterns
Strategy: retry
Validate before calling
// ensure the feed is fully loaded before publishing
await page.goto('https://weibo.com', { waitUntil: 'load', settleMs: 3000 }); Try / catch
try {
await cli.run(['weibo', 'publish', '--text', text]);
} catch (err) {
if (/Could not open compose editor|Could not find/.test(err.message)) {
await new Promise(r => setTimeout(r, 3000));
await cli.run(['weibo', 'publish', '--text', text]); // one retry
} else throw err;
} Prevention
- Allow full page settle before publishing
- Dismiss popups/interstitials in the session
- Update the library when Weibo ships UI redesigns
When it happens
Trigger: The 发微博 button is absent or not clickable — page rendered differently (logged-out, A/B variant, mobile layout), overlay/popup blocking it, or Weibo's DOM/class names changed.
Common situations: Weibo frontend redesigns; slow loads where the button has not hydrated yet; regional variants of weibo.com with different chrome; promotions/interstitial dialogs covering the button.
Related errors
- Waiting for 12306 tk auth cookie
- ChatGPT composer is not available on the current page.
- Could not find the ChatGPT model selector in the composer.
- Could not click the ChatGPT ${target.label} model option.
- Could not find the ChatGPT tools menu button in the composer
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/19fb265bf17656cc.
Report an issue: GitHub.