加固每日账单导出:设置日期前先关授权弹窗并逐次校验日历面板
This commit is contained in:
parent
80978061de
commit
73af15f2db
@ -118,13 +118,20 @@ cdp.on((msg) => {
|
||||
|
||||
// 1) 设置结算时间 = 月初 → 昨日(日历面板)
|
||||
log('设置结算时间');
|
||||
for (let attempt = 1; attempt <= 3; attempt++) {
|
||||
// 「店铺授权过期提醒」会反复弹出遮挡,先关弹窗再点日期框,并逐次校验面板是否真的打开
|
||||
let calendarOpen = false;
|
||||
for (let attempt = 1; attempt <= 8 && !calendarOpen; attempt++) {
|
||||
await closeAuthModal(cdp, sid, 2);
|
||||
const sBox = await evaluate(cdp, sid, `(() => { const i = [...document.querySelectorAll('input')].find(x => x.placeholder === '开始日期' && (x.offsetWidth||x.offsetHeight)); const r = i.getBoundingClientRect(); return { x: r.left + 6, y: r.top + r.height/2 }; })()`);
|
||||
await clickPoint(cdp, sid, sBox.x, sBox.y);
|
||||
await sleep(1800);
|
||||
await sleep(1900);
|
||||
const cells = await evaluate(cdp, sid, `document.querySelectorAll('.ant-picker-dropdown td[title]').length`);
|
||||
if (cells > 0) break;
|
||||
await closeAuthModal(cdp, sid, 1);
|
||||
calendarOpen = cells > 0;
|
||||
if (!calendarOpen) log(` 日历未打开,第 ${attempt} 次重试`);
|
||||
}
|
||||
if (!calendarOpen) {
|
||||
await shot(cdp, sid, OUT_DIR + '\\date-panel-failed.png');
|
||||
throw new Error('日历面板未能打开,已截图:' + OUT_DIR + '\\date-panel-failed.png');
|
||||
}
|
||||
async function pickDate(title) {
|
||||
for (let i = 0; i < 30; i++) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user