From f88b22d0c040b91f1184eb8d181d06be7f04ce32 Mon Sep 17 00:00:00 2001 From: Sang Nguyen Date: Wed, 28 Dec 2022 00:12:43 +0700 Subject: [PATCH] docs: fix wrong waitForResponse example in Node.js (#19701) --- docs/src/api/class-page.md | 4 ++-- packages/playwright-core/types/types.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 5557aef326..938dfbdaa4 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -4250,12 +4250,12 @@ Returns the matched response. See [waiting for event](../events.md#waiting-for-e ```js // Start waiting for response before clicking. Note no await. -const responsePromise = page.waitForRequest('https://example.com/resource'); +const responsePromise = page.waitForResponse('https://example.com/resource'); await page.getByText('trigger response').click(); const response = await responsePromise; // Alternative way with a predicate. Note no await. -const responsePromise = page.waitForRequest(response => response.url() === 'https://example.com' && response.status() === 200); +const responsePromise = page.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200); await page.getByText('trigger response').click(); const response = await responsePromise; ``` diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index c00b3acedb..8e50da0ce0 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -4447,12 +4447,12 @@ export interface Page { * * ```js * // Start waiting for response before clicking. Note no await. - * const responsePromise = page.waitForRequest('https://example.com/resource'); + * const responsePromise = page.waitForResponse('https://example.com/resource'); * await page.getByText('trigger response').click(); * const response = await responsePromise; * * // Alternative way with a predicate. Note no await. - * const responsePromise = page.waitForRequest(response => response.url() === 'https://example.com' && response.status() === 200); + * const responsePromise = page.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200); * await page.getByText('trigger response').click(); * const response = await responsePromise; * ```