{"record":{"id":"92d426557e3a43a9","repo":"jackwener/OpenCLI","slug":"unsupported-doubao-input-element","errorCode":null,"errorMessage":"Unsupported Doubao input element","messagePattern":"Unsupported Doubao input element","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clis/doubao/utils.js","lineNumber":427,"sourceCode":"        composer.textContent = '';\n        const selection = window.getSelection();\n        const range = document.createRange();\n        range.selectNodeContents(composer);\n        range.collapse(false);\n        selection?.removeAllRanges();\n        selection?.addRange(range);\n        document.execCommand('insertText', false, inputText);\n        composer.dispatchEvent(new InputEvent('beforeinput', { bubbles: true, data: inputText, inputType: 'insertText' }));\n        composer.dispatchEvent(new InputEvent('input', { bubbles: true, data: inputText, inputType: 'insertText' }));\n        composer.dispatchEvent(new Event('change', { bubbles: true }));\n        return {\n          hasText: !!((composer.innerText || '').trim() || (composer.textContent || '').trim()),\n          mode: 'contenteditable',\n          text: (composer.innerText || '').trim() || (composer.textContent || '').trim(),\n        };\n      }\n\n      throw new Error('Unsupported Doubao input element');\n    })(${JSON.stringify(text)})\n  `;\n}\nfunction detectDoubaoVerificationScript() {\n    return `\n    (() => {\n      const isVisible = (el) => {\n        if (!(el instanceof HTMLElement)) return false;\n        const style = window.getComputedStyle(el);\n        if (style.display === 'none' || style.visibility === 'hidden') return false;\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0;\n      };\n\n      const challengeSelectors = [\n        'iframe[src*=\"captcha\"]',\n        'iframe[src*=\"verify\"]',\n        'input[placeholder*=\"验证码\"]',","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/doubao/utils.js#L409-L445","documentation":"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.","triggerScenarios":"findComposer() returns an element that is not HTMLTextAreaElement, HTMLInputElement, and has no isContentEditable — typically after a Doubao UI change introducing a custom editor component.","commonSituations":"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.","solutions":["Update the library to a version supporting the new Doubao composer element","Switch off any Doubao beta/new-UI setting so the classic composer renders","Fall back to native typing (page.nativeType) after focusing the composer manually","Clear browser extensions that may rewrite the composer DOM"],"exampleFix":"// before (script only handles 3 shapes)\nthrow new Error('Unsupported Doubao input element');\n// after\nif (composer.setRangeText || composer.attachShadow) {\n  composer.focus();\n  document.execCommand('insertText', false, inputText);\n  return { hasText: true, mode: 'shadow-editor', text: composer.textContent.trim() };\n}\nthrow new Error('Unsupported Doubao input element');","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isSupportedComposer(el) {\n  return el instanceof HTMLTextAreaElement || el instanceof HTMLInputElement || el.isContentEditable === true;\n}","tryCatchPattern":"try {\n  await page.evaluate(fillComposerScript(text));\n} catch (e) {\n  if (/Unsupported Doubao input element/.test(e.message)) {\n    await composer.focus();\n    await page.nativeType(text); // fall back to keystrokes\n  } else throw e;\n}","preventionTips":["Disable Doubao beta UI during automation","Pin known-good Doubao page versions when possible","Add a DOM snapshot on failure to diagnose new element types","Keep the library updated for new composer support"],"tags":["doubao","dom-locator","composer","unsupported-element"],"backgroundTag":"unsupported-element-type","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}