Fulfill with the modified body: await route.fulfill({ response, json })
Navigate to the page: await page.goto('/shop') — the intercepted response will return the modified data
Assert that the UI reflects the stubbed data using standard Playwright locator assertions
Known gotchas
route.fulfill({ json }) sets Content-Type to application/json automatically; do not also pass a body string or the content type header will conflict
Routes registered with page.route() only intercept requests made from that page; requests from workers or iframes in separate origins require context.route() instead
Playwright evaluates route handlers in registration order; if multiple routes match the same URL pattern, only the first matching handler runs unless you call route.fallback() to pass through to the next handler
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp