Added proper page capture for error debugging.
This commit is contained in:
+11
-2
@@ -86,10 +86,19 @@ export async function fetchToc(
|
|||||||
const urls = await pRetry(
|
const urls = await pRetry(
|
||||||
async () => {
|
async () => {
|
||||||
await driver.get(sourceUrl);
|
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!);
|
await executeStealthSteps(driver, def.stealth!);
|
||||||
|
|
||||||
// Read the live rendered DOM (post-JS, post-uBlock) and the URL we
|
// Re-capture after steps complete — dynamic content should now be present.
|
||||||
// actually landed on (may differ from sourceUrl after redirects).
|
|
||||||
lastHtml = (await driver.executeScript(
|
lastHtml = (await driver.executeScript(
|
||||||
'return document.documentElement.outerHTML',
|
'return document.documentElement.outerHTML',
|
||||||
)) as string;
|
)) as string;
|
||||||
|
|||||||
Reference in New Issue
Block a user