Puppeteer Max Timeout Error - Workaround

09-23-2020

I’ve been using Puppeteer a lot recently for automated testing and more often for web scraping. Often times though I’ve run into a timeout error where I’ve exceeded the default 30000ms timeout when requesting a new page in the headless Chrome browser. This is really common for heavier pages that are loading a LOT of assets.

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.

Documentation and Additional options

The solution looks something like:

1
2
3
4
5
6
7
8
9
10
const browser = await puppeteer.launch({
headless: true,
});
const page = await browser.newPage();

await page.goto(`https://myamazingwebsite.com`, {
waitUntil: "load",
// Remove the timeout
timeout: 0,
});