我有一个问题,我无法使用 Puppeteer。我什至尝试了文档中的一个基本示例。 但我收到此错误:
<块引用>UnhandledPromiseRejectionWarning: TimeoutError: Navigation timeout of 超过 30000 毫秒
我搜索了一些解决方案,例如禁用超时,但它不起作用。
我在 Windows 上使用 WSL:Ubuntu
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({args: [
'--no-sandbox',
]});
const page = await browser.newPage();
await page.goto('https://news.ycombinator.com', {
waitUntil: 'networkidle2',
});
await page.pdf({ path: 'hn.pdf', format: 'a4' });
await browser.close();
})();
如果您有一些提示可以帮助我! 谢谢!