Network Interception
How a Playwright run takes over the request layer: matching routes, fulfilling or aborting them, replaying HAR files, and calling APIs directly to reach states no real backend will produce.
on this pageshowhide
explore
- Request Control21 questions
- Matching a Route5 questions
- Fulfil and Abort6 questions
- HAR Record and Replay5 questions
- WebSocket Channels5 questions
- Traffic Observation11 questions
- Request Event Hooks5 questions
- Direct API Calls6 questions
questions
page 2 of 2In Playwright, when should a suite fully mock a WebSocket instead of routing it to the real server?
level: principalimportance: should knowfreq 28%
basics
~20 sMock fully when determinism, offline runs and speed matter more than fidelity, which covers the bulk of UI cases. Connect to the real server when the handshake is complex or integration itself is the point.
When should a Playwright suite fulfil from fixtures instead of fetching and mutating the real API?
level: principalimportance: nice to knowfreq 24%
basics
~20 sFulfil from fixtures for everything that runs on every commit, because those tests must be fast, hermetic and deterministic. Reserve fetching and mutating the real response for a thin, separately scheduled layer whose job is noticing that the upstream contract has drifted.
showing 31–32 of 32