Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
method Page.prototype.waitForNavigation
import { Page } from "https://deno.land/x/puppeteer@14.1.1/vendor/puppeteer-core/puppeteer/common/Page.js";

This resolves when the page navigates to a new URL or reloads. It is useful when you run code that will indirectly cause the page to navigate. Consider this example:

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>

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.