Skip to main content
Version: Next

Page.goto() method

Navigates the frame or page to the given url.

Signature:

class Page {
goto(url: string, options?: GoToOptions): Promise<HTTPResponse | null>;
}

Parameters

Parameter

Type

Description

url

string

URL to navigate the frame to. The URL should include scheme, e.g. https://

options

GoToOptions

(Optional) Options to configure waiting behavior.

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.

Remarks

Navigation to about:blank or navigation to the same URL with a different hash will succeed and return null.

warning

Headless shell mode doesn't support navigation to a PDF document. See the upstream issue.

In headless shell, this method will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not Found" and 500 "Internal Server Error". The status code for such responses can be retrieved by calling HTTPResponse.status().