-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[Feature] Capture network requests on BrowserContext #6340
Copy link
Copy link
Closed
Labels
Description
Currently when page issues requests, we can use the request event on the page to capture the network request and get the timing information. But if the page opens a new popup or window, the network request information for those requests gets lost
<p><a href="popup2.html" target="_blank" id="linkWithPopupNoNewWindow">Click</a>here (id=linkWithPopupNoNewWindow) to open - Test Page - new tab</p>// will not log the requests to the popup page and also the resources in page1.
page.on("request", req => console.log("Request", request.url());
await page.goto("index.html"); // goes to index page
const [page1] = await Promise.all([
context.waitForEvent('page')
page.click('#linkWithPopupNoNewWindow'),
]);
await page1.close();From the above code, we would miss out the logging for both the request to the popup2.html page and also the resources inside that page. However, the resources inside page1 can be logged by again listening to page1.on('request'), but still there is no way to get the request activity to the popup in new tab.
Is there a way to get all the network activity logged in the context of the browser level CDP session instead of creating CDP session for every page object.
Reactions are currently unavailable