You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Returns map of request ID to raw CDP request data. This will be populated as requests are made.
// See: https://itecnote.com/tecnote/missing-request-headers-in-puppeteer/
async function setupLoggingOfAllNetworkData(page) {
const cdpSession = await page.target().createCDPSession();
await cdpSession.send("Network.enable");
const cdpRequestDataRaw = {};
const addCDPRequestDataListener = (eventName) => {
cdpSession.on(eventName, (request) => {
cdpRequestDataRaw[request.requestId] =
cdpRequestDataRaw[request.requestId] || {};
Object.assign(cdpRequestDataRaw[request.requestId], {
[eventName]: request,
});
});
};
addCDPRequestDataListener("Network.requestWillBeSent");
addCDPRequestDataListener("Network.requestWillBeSentExtraInfo");
addCDPRequestDataListener("Network.responseReceived");
addCDPRequestDataListener("Network.responseReceivedExtraInfo");
return cdpRequestDataRaw;
}
and then const cdpRequestDataRaw = await setupLoggingOfAllNetworkData(page);
and then you can merge them back into the har file from the package
the request ids match
The text was updated successfully, but these errors were encountered:
From Surya:
Solution:
and then
const cdpRequestDataRaw = await setupLoggingOfAllNetworkData(page);
and then you can merge them back into the har file from the package
the request ids match
The text was updated successfully, but these errors were encountered: