I'm using node.js and puppeteer to get some data. Some of the files I'm opening are quite large ... and then I get an error:
Error:
our error { TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded at Promise.then (/project/node_modules/puppeteer/lib/NavigatorWatcher.js:74:21) at <anonymous> name: 'TimeoutError' }
How can I ignore it or set a higher timeout?
That's my script:
await page.goto('url'+tableCell04Val, {waitUntil: 'load'});
A simple workaround is to override the default timeout value, setting the new value to _0_ and passing a “waitUntil”: “load” parameter in the options object in the Puppeteer goto() method.
You can use timeout: 0 to disable timeout errors if you're loading a heavy page. Use it in your page. goto like: await page.
You can use timeout: 0
to disable timeout errors if you're loading a heavy page.
Use it in your page.goto
like:
await page.goto('url'+tableCell04Val, {waitUntil: 'load', timeout: 0});
You can see the PR made to Pupeteer here which added the change, along with documentation and the unit tests that implement it.
#UPDATE 2019
You can also change the page behaviour since V1.0.0:
page.setDefaultNavigationTimeout(0);
The param is the timeout in milliseconds.
References: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout https://pptr.dev/#?product=Puppeteer&version=v1.17.0&show=api-pagesetdefaultnavigationtimeouttimeout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With