diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index e502dfe12c..96d5009047 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -422,7 +422,8 @@ Emitted when a request fails, for example by timing out. :::note HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete -with [`event: Page.requestFinished`] event and not with [`event: Page.requestFailed`]. +with [`event: Page.requestFinished`] event and not with [`event: Page.requestFailed`]. A request will only be considered +failed when the client cannot get an HTTP response from the server, e.g. due to network error net::ERR_FAILED. ::: ## event: Page.requestFinished diff --git a/types/types.d.ts b/types/types.d.ts index 67656ab3da..959c2b32e7 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -514,7 +514,9 @@ export interface Page { * * > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will * complete with [page.on('requestfinished')](https://playwright.dev/docs/api/class-page#pageonrequestfinished) event and - * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). + * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). A request will only + * be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error + * net::ERR_FAILED. */ on(event: 'requestfailed', listener: (request: Request) => void): this; @@ -688,7 +690,9 @@ export interface Page { * * > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will * complete with [page.on('requestfinished')](https://playwright.dev/docs/api/class-page#pageonrequestfinished) event and - * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). + * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). A request will only + * be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error + * net::ERR_FAILED. */ once(event: 'requestfailed', listener: (request: Request) => void): this; @@ -862,7 +866,9 @@ export interface Page { * * > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will * complete with [page.on('requestfinished')](https://playwright.dev/docs/api/class-page#pageonrequestfinished) event and - * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). + * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). A request will only + * be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error + * net::ERR_FAILED. */ addListener(event: 'requestfailed', listener: (request: Request) => void): this; @@ -1036,7 +1042,9 @@ export interface Page { * * > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will * complete with [page.on('requestfinished')](https://playwright.dev/docs/api/class-page#pageonrequestfinished) event and - * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). + * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). A request will only + * be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error + * net::ERR_FAILED. */ removeListener(event: 'requestfailed', listener: (request: Request) => void): this; @@ -1210,7 +1218,9 @@ export interface Page { * * > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will * complete with [page.on('requestfinished')](https://playwright.dev/docs/api/class-page#pageonrequestfinished) event and - * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). + * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). A request will only + * be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error + * net::ERR_FAILED. */ off(event: 'requestfailed', listener: (request: Request) => void): this; @@ -3022,7 +3032,9 @@ export interface Page { * * > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will * complete with [page.on('requestfinished')](https://playwright.dev/docs/api/class-page#pageonrequestfinished) event and - * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). + * not with [page.on('requestfailed')](https://playwright.dev/docs/api/class-page#pageonrequestfailed). A request will only + * be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error + * net::ERR_FAILED. */ waitForEvent(event: 'requestfailed', optionsOrPredicate?: { predicate?: (request: Request) => boolean | Promise, timeout?: number } | ((request: Request) => boolean | Promise)): Promise;