-
Notifications
You must be signed in to change notification settings - Fork 59
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
Timeout error when waiting for browser response #7
Comments
Another detail that I just noticed, the browser is not going through cloudflare if you have the |
First of all, the code you provided is very different from the event you conveyed. I tried to edit your code and add it below. I could not see an error in this code as you stated. If you are having a problem like this when trying to switch to cloudflare, the solution is very easy.
In this way you should issue a command to wait until the dom is loaded. Otherwise puppeteer will not accept the page as loaded and will give a timeout error. If the problem persists, I can help if you provide a working code. I think the code below is not related to this issue.
|
Can you try Headless as 'new'? |
If your problem is that the browser connection is lost after redirects, I did not have such a problem with the code in the image below. If you can provide more details about the error, I can help. |
I ended up sending only part of the code, as it is modularized, I will put them all in the same file to show you Functions responsible for creating the browser and logging in
And this is the part of the code where I import and run configBrowser and login
Please note that this error does not occur on the first run, however after it occurs once, I need to end all processes related to it through the task manager, or restart the PC and then it will behave normally again. |
This does not seem to be a library problem. If the site has cloudflare, the goto function does not complete and waits. After 30 seconds you get an error. For this I don't recall any code in puppeteer-real-browser that could cause this kind of error. This error is usually caused by incomplete loading.
Please change the redirection parts in your code as above. I believe the problem will be solved. |
I had a very similar problem due to the targetFilter argument set by puppeteer-real-browser, when launching puppeteer. While There is no real and easy way to solve this in the general case and my recommendation is to set targetFilter to a user-controlled function like for example: targetFilter: (target) => avoidTurnstileTarget() ? !!target.url() : true I didn't test it for @MiguelRomaniw case however. |
When I put handless: true it does not pass the cloudflare check And when I put handless: 'new' It displays the browser normally
Now, regarding the page.goto() error and the oage.reload(), with the code you provided so far there were no problems
|
I'm glad you didn't encounter an error during your trial. Please add to this discussion if you get an error. Headless false and New were not tried in Windows environment. This issue will be fixed in the next update. |
Just confirmed this to be the case. Try: const {browser, page} = await puppeteerRealBrowser({headless: false});
await page.goto('https://www.betano.de/');
await browser.close(); With the puppeteer-real-browser target filter |
if we add = |
This issue has been resolved please try the latest version of the library. If the problem persists you can start a new discussion. |
Basically, during the execution of the code, after I give a new page.goto (new url), the puppeteer loses the browser reference and does not return anything, just the TimeoutError error
export async function login(page, credentials){ try { await page.locator(
[name="Username"]).fill(credentials.user) await page.locator(
[name="Password"]).fill(credentials.password) await page.click(
[data-qa="submit"]) await page.waitForTimeout(10000) await page.goto(
https://br.betano.com/live/`)// await page.waitForNavigation({ waitUntil: 'domcontentloaded' });
// await page.evaluate(() =>{
// window.location.href =
https://br.betano.com/live/
// })
await page.waitForTimeout(10000)
await page.reload()
await page.waitForTimeout(10000)
} catch (error) {
console.log(error)
}
}`
The text was updated successfully, but these errors were encountered: