📜  puppeteer 阻止请求 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:48.442000             🧑  作者: Mango

代码示例1
await page.setRequestInterception(true);

    page.on('request', (req) => {
        if(req.resourceType() === 'image'){
            req.abort();
        }
        else {
            req.continue();
        }
    });