Merge pull request #45 from LyInfi/fix/wechat-browser-upload-progress-reeval

fix(wechat-browser): fix upload progress check crashing on second iteration
This commit is contained in:
Jim Liu 宝玉 2026-02-19 18:41:51 -06:00 committed by GitHub
commit 98f49eae96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 4 deletions

View File

@ -570,10 +570,7 @@ export async function postToWeChat(options: WeChatBrowserOptions): Promise<void>
for (let i = 0; i < 30; i++) {
await sleep(2000);
const uploadCheck = await cdp.send<{ result: { value: string } }>('Runtime.evaluate', {
expression: `
const thumbs = document.querySelectorAll('.weui-desktop-upload__thumb, .pic_item, [class*=upload_thumb]');
JSON.stringify({ uploaded: thumbs.length });
`,
expression: `JSON.stringify({ uploaded: document.querySelectorAll('.weui-desktop-upload__thumb, .pic_item, [class*=upload_thumb]').length })`,
returnByValue: true,
}, { sessionId });
const status = JSON.parse(uploadCheck.result.value);