{"record":{"id":"ded8e26533628a5b","repo":"jackwener/OpenCLI","slug":"could-not-find-image-file-input-on-weibo-compose-p","errorCode":null,"errorMessage":"Could not find image file input on Weibo compose page. UI may have changed.","messagePattern":"Could not find image file input on Weibo compose page\\. UI may have changed\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/publish.js","lineNumber":173,"sourceCode":"        if (!editorFound) {\n            throw new CommandExecutionError('Weibo compose editor did not appear');\n        }\n\n        // Step 5: Upload images first (before text to avoid editor reset)\n        if (absPaths.length > 0) {\n            if (!page.setFileInput) {\n                throw new CommandExecutionError('Browser extension does not support file upload. Please update the extension.');\n            }\n\n            // Find the file input\n            const fileInputFound = await page.evaluate(`\n                () => {\n                    const input = document.querySelector('input[type=\"file\"][class*=\"_file_\"]');\n                    return !!input;\n                }\n            `);\n            if (!fileInputFound) {\n                throw new CommandExecutionError('Could not find image file input on Weibo compose page. UI may have changed.');\n            }\n\n            await page.setFileInput(absPaths, FILE_INPUT_SELECTOR);\n\n            // Wait for upload to complete\n            let uploadResult = null;\n            for (let i = 0; i < Math.ceil(UPLOAD_TIMEOUT_MS / UPLOAD_POLL_MS); i++) {\n                await page.wait({ time: UPLOAD_POLL_MS / 1000 });\n                uploadResult = await page.evaluateWithArgs(`\n                    (() => {\n                        const expectedCount = expected;\n                        const uploading = document.querySelector('[class*=\"upload\"], [class*=\"progress\"]');\n                        if (uploading && uploading.offsetParent !== null) return null;\n                        const pics = document.querySelectorAll('img[class*=\"pic\"], [class*=\"imgItem\"], [class*=\"picture\"] img');\n                        if (pics.length >= expectedCount) return { ok: true, count: pics.length };\n                        return null;\n                    })()\n                `, { expected: absPaths.length });","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/publish.js#L155-L191","documentation":"Thrown when the CLI cannot locate the hidden <input type=\"file\"> element on the Weibo compose page using the selector input[type=\"file\"][class*=\"_file_\"]. The command uses this input to stage image files, so without it image upload cannot proceed. Weibo ships its frontend with CSS-module class hashes that change on every rebuild, so this is a UI-drift guard.","triggerScenarios":"page.evaluate check `document.querySelector('input[type=\"file\"][class*=\"_file_\"]')` returns null after the compose editor opened, while images were requested.","commonSituations":"Weibo redeployed their frontend and the file input's class name no longer contains the `_file_` module fragment; the compose modal failed to fully render (slow network, A/B layout test); the user is on a mobile/alternate Weibo layout where the desktop compose UI is absent.","solutions":["Retry later — often a transient render issue or a Weibo frontend rollout in progress","Update the CLI to a version with refreshed Weibo selectors (check the repo for selector-fix commits)","Open weibo.com manually and confirm the desktop compose dialog shows an image-attach button","As a workaround, publish without images and attach them manually"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const fileInput = await page.evaluate(`() => !!document.querySelector('input[type=\"file\"][class*=\"_file_\"]')`);\nif (!fileInput) {\n    console.warn('Weibo compose file input not found; publish will fail. Check weibo.com UI or update the CLI.');\n}","typeGuard":null,"tryCatchPattern":"try {\n    await publishToWeibo(text, images);\n} catch (err) {\n    if (String(err.message).includes('file input')) {\n        // fall back to text-only publish\n        await publishToWeibo(text, []);\n    } else throw err;\n}","preventionTips":["Keep the CLI updated — selector fixes ship quickly after Weibo UI rebuilds","Spot-check the compose dialog manually before scheduled image posts","Fallback to text-only publishing when image automation fails"],"tags":["dom-selector","ui-drift","weibo","scraping"],"backgroundTag":"selector-stale-dom","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}