sacred-emeraldS
Apify & Crawlee3y ago
7 replies
sacred-emerald

PlaywrightCrawler exception: page.content: Target page, context or browser has been closed

This exception happens in about 15-20% of all requests... quite often!

This line in code:
content = await page.content();


Throws this exception
page.content: Target page, context or browser has been closed
   at (<somewhere-in-my-code>.js:170:54)
   at PlaywrightCrawler.requestHandler (<somewhere-in-my-code>.js:596:15)
   at async wrap (.../node_modules/@apify/timeout/index.js:52:21)


Is it something well known?

Should I check(wait for) something before calling
page.content()
?
It is already checked that status of response.status() is less than 400 (it is actually 200, i see it in the logs)
Was this page helpful?