I can't intercept with the setRequestInterception
function, some important request doesn't go through it.
Instead I used the Network.setRequestInterception
, and it was nice in addition to not being able to abort the unwanted request.
If I intentionally ignore it with the if else sentence, a lot of request will not leave the browser and cause many errors in the suspended state.
I need an alternate command request.abort()
when I work with Network.requestIntercepted
, here is my code:
const client = await page.target().createCDPSession();
await client.send('Network.enable');
await client.send('Network.setRequestInterception',{
patterns:[
{urlPattern :'*'}
]
});
client.on('Network.requestIntercepted',async({interceptionId,request})=>{
if (request.url.indexOf('Loading') == -1 ){
await client.send('Network.continueInterceptedRequest',{
interceptionId
});
}else{
//I want request.abort()
}
});
Thanks!!