import { Page } from "https://deno.land/x/puppeteer@14.1.1/vendor/puppeteer-core/puppeteer/common/Page.d.ts";
Examples
Example 1
Example 1
const firstResponse = await page.waitForResponse(
'https://example.com/resource'
);
const finalResponse = await page.waitForResponse(
(response) =>
response.url() === 'https://example.com' && response.status() === 200
);
const finalResponse = await page.waitForResponse(async (response) => {
return (await response.text()).includes('<html>');
});
return finalResponse.ok();
Parameters
urlOrPredicate: string | ((res: HTTPResponse) => boolean | Promise<boolean>)
- A URL or predicate to wait for.
Returns
Promise<HTTPResponse>
Promise which resolves to the matched response.