Network Snippets

Interacting with network requests within Javascript can be a useful way of testing, logging or blocking resources from loading on the page.

# Capture network requests


To capture all network requests made my a page, you can make use of the window.performance class within the browser. This code should be inserted after your "Go to page" step.

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

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

return resources;

A list of resources will be present in th code-data data token to be used elsewhere in your automation. See Performance | Mozilla (opens new window) for more details.