mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
f07ad2c661
This PR updates the docs regarding configuring puppeteer. In addition, some changes have been made to the documentation generator to show default values on the documentation site. Also fixes: https://github.com/puppeteer/puppeteer/pull/9144
3.2 KiB
3.2 KiB
sidebar_label |
---|
Frame.goto |
Frame.goto() method
Navigates a frame to the given url.
Signature:
class Frame {
goto(
url: string,
options?: {
referer?: string;
timeout?: number;
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
}
): Promise<HTTPResponse | null>;
}
Parameters
Parameter | Type | Description |
---|---|---|
url | string | the URL to navigate the frame to. This should include the scheme, e.g. https:// . |
options | { referer?: string; timeout?: number; waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; } | (Optional) navigation options. waitUntil is useful to define when the navigation should be considered successful - see the docs for PuppeteerLifeCycleEvent for more details. |
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.
Exceptions
This method will throw an error if:
- there's an SSL error (e.g. in case of self-signed certificates). - target URL is invalid. - the
timeout
is exceeded during navigation. - the remote server does not respond or is unreachable. - the main resource failed to load.
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().
Remarks
Navigation to about:blank
or navigation to the same URL with a different hash will succeed and return null
.
:::warning
Headless mode doesn't support navigation to a PDF document. See the upstream issue.
:::