我正在尝试使用puppeteer
从此页面https://www.gsksaglik.com/internal-redirects.html获取请求,但似乎根本没有加载页面,因为浏览器不会关闭...
这是我的代码:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
page.on('request', (data) => console.log(data));
page.on('requestfailed', (data) => console.log(data));
page.on('requestfinished', (data) => console.log(data));
await page.goto('https://www.gsksaglik.com/internal-redirects.html');
await browser.close();
})();
事件page.request
,page.requestfailed
和requestfinised
未被解雇
有谁知道为什么没有加载这个页面?
答案 0 :(得分:0)
手动暂停
await page.goto('https://www.gsksaglik.com/internal-redirects.html', {
networkIdleTimeout: 5000,
waitUntil: 'networkidle',
timeout: 3000000
});
有关详情,请查看此链接https://github.com/GoogleChrome/puppeteer/issues/782