diff --git a/scripts/src/hwlab-node-web-sentinel-p5.ts b/scripts/src/hwlab-node-web-sentinel-p5.ts index 746914d4..069cd71e 100644 --- a/scripts/src/hwlab-node-web-sentinel-p5.ts +++ b/scripts/src/hwlab-node-web-sentinel-p5.ts @@ -713,6 +713,14 @@ if (requestedRunId) { let manualTrigger = { requested: triggerManual, ok: !triggerManual, status: triggerManual ? "not-attempted" : "not-requested", jobName: null, statusText: "" }; if (triggerManual) { + for (let attempt = 1; attempt <= 2; attempt += 1) { + const buttonReady = await page.waitForSelector("[data-monitor-manual-trigger='true']", { timeout: Math.min(20000, timeout) }).then(() => true).catch(() => false); + if (buttonReady) break; + if (attempt === 1) { + await page.reload({ timeout: perAttemptTimeout, waitUntil: "domcontentloaded" }).catch(() => null); + await page.waitForFunction(() => document.querySelector("#monitor-web-root")?.getAttribute("data-monitor-ready") === "true", null, { timeout: Math.min(12000, perAttemptTimeout) }).catch(() => {}); + } + } manualTrigger = await page.evaluate(async () => { const wait = (ms) => new Promise((resolve) => window.setTimeout(resolve, ms)); const root = document.querySelector("[data-monitor-shell='true']");