jackwener/OpenCLI · error
Could not find Doubao input element
Error message
Could not find Doubao input element
What it means
fillComposerScript injects a script that locates the Doubao message composer via buildDoubaoComposerLocatorScript(); if findComposer() returns nothing, the in-page script throws 'Could not find Doubao input element'. fillComposerScript is the fallback text-insertion path in sendDoubaoMessage, so this means neither DOM handle nor native typing could find the composer.
Source
Thrown at clis/doubao/utils.js:392
if (composer instanceof HTMLElement) {
const text = (composer.innerText || '').trim() || (composer.textContent || '').trim();
composer.dispatchEvent(new InputEvent('beforeinput', { bubbles: true, data: text, inputType: 'insertText' }));
composer.dispatchEvent(new InputEvent('input', { bubbles: true, data: text, inputType: 'insertText' }));
composer.dispatchEvent(new Event('change', { bubbles: true }));
return { hasText: !!text, text };
}
return { hasText: false, text: '' };
})()
`;
}
function fillComposerScript(text) {
return `
((inputText) => {
${buildDoubaoComposerLocatorScript()}
const composer = findComposer();
if (!composer) throw new Error('Could not find Doubao input element');
composer.focus();
if (composer instanceof HTMLTextAreaElement || composer instanceof HTMLInputElement) {
const proto = composer instanceof HTMLTextAreaElement
? window.HTMLTextAreaElement.prototype
: window.HTMLInputElement.prototype;
const setter = Object.getOwnPropertyDescriptor(proto, 'value')?.set;
setter?.call(composer, inputText);
composer.dispatchEvent(new InputEvent('beforeinput', { bubbles: true, data: inputText, inputType: 'insertText' }));
composer.dispatchEvent(new InputEvent('input', { bubbles: true, data: inputText, inputType: 'insertText' }));
composer.dispatchEvent(new Event('change', { bubbles: true }));
return { hasText: !!composer.value.trim(), mode: 'text-input', text: composer.value };
}
if (composer instanceof HTMLElement) {
composer.textContent = '';
const selection = window.getSelection();View on GitHub (pinned to 49907e53dc)
Solutions
- Ensure the browser is on a Doubao chat page (use ensureDoubaoChatPage / navigate to the chat URL first)
- Wait for the page to finish loading and retry the send
- Complete any login or verification challenge shown in the browser
- Update the library if Doubao changed composer markup
Example fix
// before
await page.evaluate(fillComposerScript(text));
// after
await ensureDoubaoChatPage(page);
await page.wait(1); // let composer hydrate
const st = await page.evaluate(fillComposerScript(text));
if (!st?.hasText) throw new CommandExecutionError('Composer not found; is the Doubao chat page loaded?'); Defensive patterns
Strategy: validation
Validate before calling
const found = await page.evaluate(() => !!document.querySelector('textarea, [contenteditable="true"], input'));
if (!found) throw new Error('Doubao composer not present; navigate to a chat page first'); Type guard
function isComposer(el) {
return el instanceof HTMLTextAreaElement || el instanceof HTMLInputElement || el?.isContentEditable === true;
} Try / catch
try {
await page.evaluate(fillComposerScript(text));
} catch (e) {
if (/Could not find Doubao input element/.test(e.message)) {
await ensureDoubaoChatPage(page);
await page.wait(1);
await page.evaluate(fillComposerScript(text));
} else throw e;
} Prevention
- Always call ensureDoubaoChatPage before composer interactions
- Wait for hydration before querying the DOM
- Detect Doubao UI/version changes and assert composer selectors in smoke tests
- Complete login/captcha screens before sending messages
When it happens
Trigger: Called from sendDoubaoMessage's fallback when the primary prepare/nativeType steps found no composer; findComposer() matches no textarea, input, or contenteditable element on the current Doubao page.
Common situations: Doubao changed its composer markup after a site update; page stuck on login/verification interstitial; user navigated away from a chat page; page still hydrating when the script runs.
Related errors
- Unsupported Doubao input element
- Unexpected Doubao probe: ${JSON.stringify(result)}
- Failed to insert text into Doubao composer
- Unexpected Boss probe: ${JSON.stringify(probe)}
- Failed to send image prompt to ChatGPT
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/68ca97f3953714b7.
Report an issue: GitHub.