Atlas › 13 Browser Automation with Playwright › Network Mocking and API Testing☰ Read as one page
Network Mocking and API Testing
11.1OverviewPlaywright can intercept, modify, and mock network requests at the browser level — without a proxy server. This lets you test edge cases…11.2Request Interceptionpage.route() intercepts requests matching a URL pattern and lets you fulfill, abort, or modify them.11.3Waiting for Network Events11.4API Testing with `request` FixturePlaywright's request fixture makes direct HTTP calls without a browser — ideal for API setup, teardown, and pure API testing.11.5Combining UI + API TestsThe most powerful pattern: use the API to set up data, verify through the UI, then validate via API.11.6Network Mocking Patterns11.7Key Takeaways- page.route() intercepts requests at the browser level — no proxy server needed - Mock APIs to test edge cases: empty states, errors, slow…