Navigation timeout of 30000 ms exceeded
Find out why your browser automation script fails with 'Navigation timeout of 30000 ms exceeded' and how to fix it

This typically happens when a page takes too long to load, or your script is not correctly waiting for the page’s navigation events. Let’s dive into the possible causes and solutions.
Common Causes
- Slow page loading: The page is heavy, slow, or depends on external resources.
- Network issues: Your environment might have unstable internet.
- Navigation not triggered: The code waits for a navigation event that doesn’t happen.
- Wrong wait conditions: Waiting for
load
instead ofdomcontentloaded
, when the page doesn’t fully load resources.
Solutions
1. Increase the navigation timeout
You can tell your automation tool to wait longer:
await page.goto('https://example.com', { timeout: 60000 });
Or globally:
const browser = await puppeteer.launch({ timeout: 60000 });
Tip: Doubling the timeout often solves slow network issues.
2. Wait for a specific event instead of full page load
Instead of waiting for the full load
, you can wait for the domcontentloaded
event:
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
This is faster and often sufficient for most scraping or automation tasks.
3. Use waitForSelector
If you know a specific element marks the page as ready, wait for it directly:
await page.goto('https://example.com');
await page.waitForSelector('#important-element');
This way, you have precise control.
4. Catch and handle timeouts gracefully
Sometimes it’s better to retry instead of failing instantly:
try {
await page.goto('https://example.com', { timeout: 30000 });
} catch (error) {
console.error('Navigation failed, retrying...');
await page.goto('https://example.com', { timeout: 60000 });
}
Retries can make your automation more robust.
Still Encountering Issues?
If increasing the timeout does not solve the problem, consider saving the page content to a file for further analysis. You can also use a visual testing tool like Buglesstack to debug your automation visually.
try {
await page.goto('https://www.google.com/search?q=puppeteer');
await page.waitForSelector('[name="q"]');
}
catch (error) {
// Prepare buglesstack data
const buglesstackData = {
url: page.url(),
screenshot: await page.screenshot({ encoding: 'base64' }),
html: await page.content(),
metadata: {},
message: error.message,
stack: error.stack
};
// Get your access token from https://app.buglesstack.com
const ACCESS_TOKEN = 'HERE_YOUR_ACCESS_TOKEN';
// Send error to buglesstack
await axios.post('https://app.buglesstack.com/api/v1/crashes', buglesstackData, {
headers: {
Authorization: `Bearer ${ACCESS_TOKEN}`,
'Content-Type': 'application/json'
}
});
// Re-throw the error to propagate it
throw error;
}
In this example, error details are captured using Buglesstack, which allows you to further analyze the issue while preserving the error chain.
By adjusting timeouts and employing debugging tools, you can effectively address Puppeteer timeout errors and improve the stability of your scripts.