The Route class represents a route handler that can intercept, modify, or mock network requests. Routes are created usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/microsoft/playwright/llms.txt
Use this file to discover all available pages before exploring further.
page.route() or context.route().
Methods
request
Returns the request associated with this route.Request
abort
Aborts the request.Optional error code. Defaults to ‘failed’.Possible values:
aborted, accessdenied, addressunreachable, blockedbyclient, blockedbyresponse, connectionaborted, connectionclosed, connectionfailed, connectionrefused, connectionreset, internetdisconnected, namenotresolved, timedout, failedfulfill
Fulfills the request with a custom response.Response status code. Defaults to 200.
Response headers. Header values must be strings.
Response content type. If not set, will be inferred from body.
Response body.
JSON response body. Mutually exclusive with
body.File path to read response body from.
APIResponse to fulfill with. Status and headers will be copied from the response.
continue
Continues the request with optional modifications.Override request URL.
Override request method (GET, POST, etc.).
Override request headers.
Override request post data.
fallback
Falls back to the next route handler or default behavior.Override request URL.
Override request method.
Override request headers.
Override request post data.
fetch
Fetches the original request and returns the response.Override request URL.
Override request method.
Override request headers.
Override request post data.
Maximum number of redirects to follow. Defaults to 20.
Maximum number of retries. Defaults to 0.
Request timeout in milliseconds.
Promise<APIResponse>
