The following code randomly fails with:
Execution context was destroyed, most likely because of a navigation.
Why is that? Any workarounds?
I use puppeteer version 1.19.0
const puppeteer = require("puppeteer");
(async () => {
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.setCacheEnabled(false);
const response = await page.goto("https://docs.cypress.io/", {
waitUntil: "networkidle0",
timeout: 60000
});
const pageUrls = await page.evaluate(() => {
const links = Array.from(document.querySelectorAll("a"));
return links.map(link => link.href);
});
console.log({ pageUrls });
} catch (error) {
console.log(error.message);
}
await browser.close();
})();
from puppeteer page.evaluate() randomly fails with: Execution context was destroyed, most likely because of a navigation
i have the same problem
ReplyDelete