Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fresh/tests/deps.ts>Page#waitForResponse

The next-gen web framework.
Extremely Popular
Go to Latest
method Page.prototype.waitForResponse
Re-export
import { Page } from "https://deno.land/x/fresh@1.5.1/tests/deps.ts";

Examples

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.
optional
options: { timeout?: number; }
  • Optional waiting parameters

Returns

Promise<HTTPResponse>

Promise which resolves to the matched response.