Network mocking
page.route(pattern, handler) intercepts requests matching a URL glob.
The handler chooses fulfill (mock a response), continue_route
(forward with modifications), or abort (cancel with an error code).
Mock a JSON response
Block third-party trackers
Modify a request
Wait for a specific response
TypeScript
Context-wide routing
BrowserContext::route applies to every page in the context — useful
when you have multi-tab flows:
HAR recording
Capture all network traffic to a HAR file for later replay or inspection:
The bidi backend does not support HAR recording — it returns
FerriError::Unsupported. Use cdp-pipe / cdp-raw / webkit for HAR
flows.
Removing routes
Or set up the route inside a test fixture so teardown removes it automatically when the context closes.