Could anyone tell me how I could know the following?
await page.setRequestInterception(true);
page.on('request', (req) => {
if (req.isInterceptResolutionHandled()) {
return;
}
//---------------------------------------------------------------------
//HOW TO KNOW IF CURRENT "req" IS DUE TO AN "<iframe>"'s DOCUMENT LOADED?
//---------------------------------------------------------------------
});
await page.goto('https://web-site.com/web-page-containing-iframes');
I have tried without success executing the following fragment (just replacing the comment):
let frame = page.frames().find(f => f.url() === req.url());
if (typeof frame !== 'undefined') {
console.log('EUREKA!');
}
Obviously it doesn’t work because the new URL hasn’t been loaded into the iframe.
New contributor
Albert Hastings is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.