Added proper page capture for error debugging.

This commit is contained in:
qwsdcvghyu89
2026-06-17 08:01:10 +10:00
parent a10437c217
commit 5ac2ba6fb5
+11 -2
View File
@@ -86,10 +86,19 @@ export async function fetchToc(
const urls = await pRetry(
async () => {
await driver.get(sourceUrl);
// Capture page immediately after navigation so the analyzer always has
// something even if a later step (e.g. waitForElement) times out.
lastHtml = (await driver.executeScript(
'return document.documentElement.outerHTML',
)) as string;
lastActualUrl = (await driver.executeScript(
'return window.location.href',
)) as string;
await executeStealthSteps(driver, def.stealth!);
// Read the live rendered DOM (post-JS, post-uBlock) and the URL we
// actually landed on (may differ from sourceUrl after redirects).
// Re-capture after steps complete — dynamic content should now be present.
lastHtml = (await driver.executeScript(
'return document.documentElement.outerHTML',
)) as string;