Puppeteer Max Timeout Error - Workaround

Sep 23, 2020 min read

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:

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,
});