Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to specify options for browser.goto #41

Closed
Valve opened this issue Jan 25, 2020 · 3 comments
Closed

Add ability to specify options for browser.goto #41

Valve opened this issue Jan 25, 2020 · 3 comments

Comments

@Valve
Copy link
Contributor

Valve commented Jan 25, 2020

Currently it's not possible to specify options in browser.goto, but some options are necessary, for example wait_until as in puppeteer

@dsisnero
Copy link

+1
page.goto(url[, options])
url URL to navigate page to. The url should include scheme, e.g. https://.
options Navigation parameters which might have the following properties:
timeout Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the page.setDefaultNavigationTimeout(timeout) or page.setDefaultTimeout(timeout) methods.
waitUntil <string|Array> When to consider navigation succeeded, defaults to load. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
load - consider navigation to be finished when the load event is fired.
domcontentloaded - consider navigation to be finished when the DOMContentLoaded event is fired.
networkidle0 - consider navigation to be finished when there are no more than 0 network connections for at least 500 ms.
networkidle2 - consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.
referer Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders().
returns: <Promise<?Response>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
page.goto 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.
page.goto 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 response.status().

NOTE page.goto either throws an error or returns a main resource response. The only exceptions are navigation to about:blank or navigation to the same URL with a different hash, which would succeed and return null.

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

Shortcut for page.mainFrame().goto(url, options)

@route
Copy link
Member

route commented Feb 21, 2020

In fact it's the major difference between the two. Puppeteer will return control right after it gets response from Chrome that goto command accepted, but Ferrum waits until the page is loaded. If there's JS on the page or some async rendering nothing will help because there's no way to realise that async rendering is done. So if you want to wait that there are no pending network connections I suggest using network.wait_for_idle

@route route closed this as completed Feb 21, 2020
@alexanderadam
Copy link
Contributor

alexanderadam commented Apr 4, 2024

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

Can you please point me to the upstream issue?

It is the following error (when not running in headless mode), right?

Capybara showing the Chrome Window with the error message Failed to load PDF document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants