Skip to content

[Feature] Capture network requests on BrowserContext #6340

Closed

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions