-
Notifications
You must be signed in to change notification settings - Fork 9.2k
UnhandledPromiseRejectionWarning on Navigation Timeout Exceeded #2482
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
Comments
same problem here. node-v: 9.7.1 goPage: async function (url) {
let page = await this.page;
await page.goto(url);
await page.setViewport({width: 1366, height: 768});
try {
const waitNavigationPromise = page.waitForNavigation({timeout: 10000, waitUntil: "load"});
await waitNavigationPromise;
return await page;
}
catch(e) {
this.catchError(e, page);
return false;
}
},
|
@hkhan-lumatax can you please provide a reproducible example? It should be a script that I'll be able to run locally to see the issue. We won't be able to help otherwise. |
@aslushnikov I seem to have ran into the same issue. Here's a reproducible example: const puppeteer = require('puppeteer');
const getData = async () => {
const browser = await puppeteer.launch({
executablePath: '/usr/bin/chromium',
headless: false
});
const page = await browser.newPage();
page.goto('https://discordbots.org');
await page.waitFor('.bot-list-section')
const data = await page.$$eval('.bot-card', divs => Array.from(divs).map(bot => ({
id: bot.querySelector('.info a').href.split('/').pop(),
name: bot.querySelector('.bot-name').innerHTML,
status: bot.querySelector('.status').innerHTML
})))
browser.close();
return data;
};
getData()
.then(data => {
console.log(data.length);
}); The browser opens, the result gets logged and the browser closes. The process idles for 30 seconds. The error gets logged, and then the process exits. The error does not occur if you My environment information:
|
'load' worked for me:
|
im seeing neither works |
I believe you were doing it the wrong way. You shall define waiter promise at first, call the URL change and then await waiter promise to complete.
Of course, you can add |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it! |
Steps to reproduce
Environment:
Steps
Below is the code producing this problem:
When a request times out, I get the following error:
What is the expected result?
The page and browser should get closed without throwing an exception/error.
What happens instead?
Error: Protocol error (Runtime.callFunctionOn): Target closed.
is displayed instead of the page and browser getting closed gracefully. Timeout Exceeded error is understandable and is correct.I want to understand why
Error: Protocol error (Runtime.callFunctionOn): Target closed.
is being thrown and how we can avoid it?The text was updated successfully, but these errors were encountered: