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

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

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

Waits for the page to navigate to a new URL or to reload. It is useful when you run code that will indirectly cause the page to navigate.

Examples

Example 1

const [response] = await Promise.all([
  page.waitForNavigation(), // The promise resolves after navigation has finished
  page.click('a.my-link'), // Clicking the link will indirectly cause a navigation
]);

Parameters

optional
options: WaitForOptions
  • Navigation parameters which might have the following properties:

Returns

Promise<HTTPResponse | null>

A Promise which resolves to the main resource response.

  • In case of multiple redirects, the navigation will resolve with the response of the last redirect.
  • In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with null.