docs: fix wrong waitForResponse example in Node.js (#19701)
This commit is contained in:
Родитель
cb0688bb52
Коммит
f88b22d0c0
|
@ -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;
|
||||
```
|
||||
|
|
|
@ -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;
|
||||
* ```
|
||||
|
|
Загрузка…
Ссылка в новой задаче