Network snippets

Network snippets help you inspect, log, and react to the requests a page makes during a run.

Capture network requests


Capture every network request a page has made using the Performance API. Add this snippet after a Go to page step:

var resources = [];
const entries = window.performance.getEntriesByType('resource');

entries.forEach(entry => {
    resources.push([entry.entryType, entry.name]);
});

return resources;

The list of resources is available in the code-data token for use in later steps.