jackwener/OpenCLI · error

Unsupported Doubao input element

Error message

Unsupported Doubao input element

What it means

After locating the Doubao composer, fillComposerScript handles three shapes: textarea, input, and contenteditable. If the found element is none of these, the script throws 'Unsupported Doubao input element'. This means Doubao introduced a composer element type the library does not know how to type into.

Source

Thrown at clis/doubao/utils.js:427

        composer.textContent = '';
        const selection = window.getSelection();
        const range = document.createRange();
        range.selectNodeContents(composer);
        range.collapse(false);
        selection?.removeAllRanges();
        selection?.addRange(range);
        document.execCommand('insertText', false, 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.innerText || '').trim() || (composer.textContent || '').trim()),
          mode: 'contenteditable',
          text: (composer.innerText || '').trim() || (composer.textContent || '').trim(),
        };
      }

      throw new Error('Unsupported Doubao input element');
    })(${JSON.stringify(text)})
  `;
}
function detectDoubaoVerificationScript() {
    return `
    (() => {
      const isVisible = (el) => {
        if (!(el instanceof HTMLElement)) return false;
        const style = window.getComputedStyle(el);
        if (style.display === 'none' || style.visibility === 'hidden') return false;
        const rect = el.getBoundingClientRect();
        return rect.width > 0 && rect.height > 0;
      };

      const challengeSelectors = [
        'iframe[src*="captcha"]',
        'iframe[src*="verify"]',
        'input[placeholder*="验证码"]',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Update the library to a version supporting the new Doubao composer element
  2. Switch off any Doubao beta/new-UI setting so the classic composer renders
  3. Fall back to native typing (page.nativeType) after focusing the composer manually
  4. Clear browser extensions that may rewrite the composer DOM

Example fix

// before (script only handles 3 shapes)
throw new Error('Unsupported Doubao input element');
// after
if (composer.setRangeText || composer.attachShadow) {
  composer.focus();
  document.execCommand('insertText', false, inputText);
  return { hasText: true, mode: 'shadow-editor', text: composer.textContent.trim() };
}
throw new Error('Unsupported Doubao input element');
Defensive patterns

Strategy: type-guard

Type guard

function isSupportedComposer(el) {
  return el instanceof HTMLTextAreaElement || el instanceof HTMLInputElement || el.isContentEditable === true;
}

Try / catch

try {
  await page.evaluate(fillComposerScript(text));
} catch (e) {
  if (/Unsupported Doubao input element/.test(e.message)) {
    await composer.focus();
    await page.nativeType(text); // fall back to keystrokes
  } else throw e;
}

Prevention

When it happens

Trigger: findComposer() returns an element that is not HTMLTextAreaElement, HTMLInputElement, and has no isContentEditable — typically after a Doubao UI change introducing a custom editor component.

Common situations: Doubao frontend update swapping the textarea for a custom rich editor; beta/experimental Doubao UI; browser extension altering the DOM; shadow-DOM composer not matching contenteditable checks.

Related errors


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