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.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
added test.
Petr Patek47f20731d5a0
diff --git a/test/puppeteer_pool.test.js b/test/puppeteer_pool.test.jsindex 12490af6b..872a19730 100644--- a/test/puppeteer_pool.test.js+++ b/test/puppeteer_pool.test.js@@ -230,6 +230,30 @@ describe('PuppeteerPool', () => {await pool.destroy();});+ test('does not create more than maxOpenPagesPerInstance', async () => {+ const pool = new Apify.PuppeteerPool({+ maxOpenPagesPerInstance: 2,+ retireInstanceAfterRequestCount: 100,+ });+ const opennedPages = [];++ for (let i = 0; i < 12; i++) {+ opennedPages.push(pool.newPage());+ }+ await Promise.all(opennedPages);++ const instances = Object.entries(pool.activeInstances);++ expect(instances.length).toEqual(6);++ instances.forEach(([index, instance]) => {+ expect(instance.activePages).toEqual(2);+ });++ // Cleanup everything.+ await pool.destroy();+ });+test('supports recycleDiskCache option', async () => {const pool = new Apify.PuppeteerPool({maxOpenPagesPerInstance: 1,