Im using playwright for webscraping and all i sugegstions I could see was to use timeout of 0 to avoid a timeout error. It seemed to work at first but now I again got the timeout error. Am I doing something wrong or is there another way to solve that issue? Thanks
browser = await playwright.chromium.launch({headless: true});
const page = await browser.newPage();
try {
const p = await page.goto(url, {timeout: 0});
if (p.status() < 400) {
const html = await page.content();
return html;
} else {
return null;
}
} catch(err) {
return err;
}
I am suspecting since you are not closing the browser the issue has occurred or it could be returning to something which is not called. I ran your script and it worked fine
You can check above code execution here: https://try.playwright.tech/