gpt4 book ai didi

web-scraping - 错误: Page crashed! at Page._onTargetCrashed PUPPETEER

转载 作者:行者123 更新时间:2023-12-02 07:30:48 24 4
gpt4 key购买 nike

即使通过catch处理并使用page.on(error),我也遇到页面崩溃错误。请帮助我解决此错误。

  // open the headless browser
var browser = await puppeteer.launch({ headless: true, args: ['--disable-gpu','--disable-dev-shm-usage', '--no-sandbox', '--disable-setuid-sandbox'] });
// Open a new page
var page = await browser.newPage();
var hsURL =highschoolURL.concat(hsList[i].trim()).concat("/academics");
await page.setDefaultNavigationTimeout(0);
page.on('error', err=> {
console.log('error happen at the page: ', err);
});

page.on('pageerror', pageerr=> {
console.log('pageerror occurred: ', pageerr);
})
await page.goto(hsURL, {waitUntil : 'networkidle2'}).catch(e => console.error(e));

最佳答案

默认的setDefaultNavigationTimeout为3000(3秒)。您不应将setDefaultNavigationTimeout设置为0。只需将setDefaultNavigationTimeout设置为等待页面即可。setDefaultNavigationTimeout(3000); 或删除该句子

关于web-scraping - 错误: Page crashed! at Page._onTargetCrashed PUPPETEER,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61553152/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com