From 9dac73c9ff8e830f8433fa983e46915f5ec569ee Mon Sep 17 00:00:00 2001 From: ray <1416431931@qq.com> Date: Wed, 29 Apr 2026 15:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A2=E5=8D=95=E7=88=AC?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aliyun-sync/aliyun-aps-sync/src/sync.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/aliyun-sync/aliyun-aps-sync/src/sync.js b/aliyun-sync/aliyun-aps-sync/src/sync.js index 58a1f64..9ff7734 100644 --- a/aliyun-sync/aliyun-aps-sync/src/sync.js +++ b/aliyun-sync/aliyun-aps-sync/src/sync.js @@ -336,7 +336,7 @@ async function captureErrorArtifacts(page, metadata = {}) { let screenshotSaved = false; if (page) { try { - await page.screenshot({ path: screenshotPath, fullPage: true }); + await page.screenshot({ path: screenshotPath, fullPage: true, timeout: 5000, animations: 'disabled' }); screenshotSaved = true; } catch (error) { console.error('[错误截图] 保存失败:', error.message); @@ -1503,7 +1503,18 @@ async function typeIntoDateInput(locator, value, page) { async function clickQuery(page) { await runtimeCheckpoint('点击查询'); const button = page.locator('button:has-text("查询")').first(); - await button.click(); + await button.scrollIntoViewIfNeeded().catch(() => null); + await button.evaluate((node) => { + node.scrollIntoView({ block: 'center', inline: 'center', behavior: 'instant' }); + }).catch(() => null); + + try { + await button.click({ timeout: 8000 }); + } catch (error) { + console.warn(`[查询按钮] click 失败,尝试 Enter 兜底: ${error.message}`); + await button.focus().catch(() => null); + await page.keyboard.press('Enter'); + } await sleep(1800); }