修复订单爬取
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user