Not all requests made within a given browser session are useful for the task at hand. Network Interception is the practice of programmatically monitoring, filtering, and transforming requests and responses to better suit your needs. It’s particularly useful when tuning performance of existing scripts, to make them cheaper, faster, and more stable.
In service of such goals, you might filter out all requests for images, fonts, or even stylesheets. Alternatively, you may prefer to skip a request and return mock data in its place. In many cases, this will allow you to focus on your script’s primary tasks by filtering extraneous resources. And in some interesting cases, this technique may be useful for avoiding a servers anti-bot defenses.
Network interception can even be used for testing. For instance, a business might simulate slow network speeds during tests to ensure their websites run smoothly even under stress. Alternatively, API requests might be mocked so that the test can more easily test edge-cases.
How can BrowserCat help with network interception?
Since BrowserCat fully supports the industry-standard automation library Playwright, we give you 100% flexibility in filtering network traffic. To get started in just a few lines of code, see our guide on resource filtering.
As a bonus, BrowserCat manages all the complexity of hosting headless browsers and scaling them up with demand. So rather than spending your time on infrastructure, you can focus on building the next killer feature.
Give us a try!
Tired of managing a fleet of fickle browsers? Sick of skipping e2e tests and paying the piper later?
Sign up now for free access to our headless browser fleet…