Version: 1.1.0


Whenever the page sends a request, such as for a network resource, the following events are emitted by playwright's page:

  • 'request' emitted when the request is issued by the page.
  • 'response' emitted when/if the response is received for the request.
  • 'requestfinished' emitted when the response body is downloaded and the request is complete.

If request fails at some point, then instead of 'requestfinished' event (and possibly instead of 'response' event), the 'requestfailed' event is emitted.

NOTE HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with 'requestfinished' event.

If request gets a 'redirect' response, the request is successfully finished with the 'requestfinished' event, and a new request is issued to a redirected url.


  • returns: <?Object> Object describing request failure, if any
    • errorText <string> Human-readable error message, e.g. 'net::ERR_FAILED'.

The method returns null unless this request has failed, as reported by requestfailed event.

Example of logging of all the failed requests:

page.on('requestfailed', request => {
console.log(request.url() + ' ' + request.failure().errorText);


  • returns: <Frame> A Frame that initiated this request.


  • returns: <Object<string, string>> An object with HTTP headers associated with the request. All header names are lower-case.


Whether this request is driving frame's navigation.


  • returns: <string> Request's method (GET, POST, etc.)


  • returns: <?string> Request's post body, if any.


  • returns: <?Object> Parsed request's body for form-urlencoded and JSON as a fallback if any.

When the response is application/x-www-form-urlencoded then a key/value object of the values will be returned. Otherwise it will be parsed as JSON.


  • returns: <?Request> Request that was redirected by the server to this one, if any.

When the server responds with a redirect, Playwright creates a new Request object. The two requests are connected by redirectedFrom() and redirectedTo() methods. When multiple server redirects has happened, it is possible to construct the whole redirect chain by repeatedly calling redirectedFrom().

For example, if the website redirects to

const response = await page.goto('');
console.log(response.request().redirectedFrom().url()); // ''

If the website has no redirects:

const response = await page.goto('');
console.log(response.request().redirectedFrom()); // null


  • returns: <?Request> New request issued by the browser if the server responded with redirect.

This method is the opposite of request.redirectedFrom():

console.log(request.redirectedFrom().redirectedTo() === request); // true


Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of the following: document, stylesheet, image, media, font, script, texttrack, xhr, fetch, eventsource, websocket, manifest, other.



  • returns: <string> URL of the request.