Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Update puppeteer_pool.js

Marek Trunkátfda8bb7ad400
diff --git a/src/puppeteer_pool.js b/src/puppeteer_pool.js
index e0ad68885..d75ad0d14 100644
--- a/src/puppeteer_pool.js
+++ b/src/puppeteer_pool.js
@@ -284,8 +284,8 @@ export default class PuppeteerPool {
.browserPromise
.then(browser => browser.pages())
.then((pages) => {
- // NOTE: we are killing instance when number of pages is 1 because there is always about:blank page.
- if (pages.length === 1) {
+ // NOTE: we are killing instance when number of pages below 1 because there is always about:blank page.
+ if (pages.length <= 1) {
log.debug('PuppeteerPool: killing retired browser because it has no open tabs', { id: instance.id });
this._killInstance(instance);
}