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
fix: bind `Browser.pages()` correctly in `PuppeteerPlugin` (#3439)
Jindřich Bärc3a4b3b0d5be
diff --git a/packages/browser-pool/src/puppeteer/puppeteer-plugin.ts b/packages/browser-pool/src/puppeteer/puppeteer-plugin.tsindex 8a5698a2c..14034e5fe 100644--- a/packages/browser-pool/src/puppeteer/puppeteer-plugin.ts+++ b/packages/browser-pool/src/puppeteer/puppeteer-plugin.ts@@ -128,6 +128,7 @@ export class PuppeteerPlugin extends BrowserPlugin<'version','on','process',+ 'pages',] as const).reduce((map, method) => {map[method] = browser[method as 'close']?.bind(browser);diff --git a/test/browser-pool/browser-plugins/plugins.test.ts b/test/browser-pool/browser-plugins/plugins.test.tsindex d64c2a296..ef530fbfc 100644--- a/test/browser-pool/browser-plugins/plugins.test.ts+++ b/test/browser-pool/browser-plugins/plugins.test.ts@@ -303,6 +303,18 @@ describe('Plugins', () => {}});+ test.concurrent('should allow calling functions on the proxied browser', async () => {+ const plugin = new PuppeteerPlugin(puppeteer);+ const launchContext = plugin.createLaunchContext();+ const browser = await plugin.launch(launchContext);++ try {+ await expect(browser.pages()).resolves.toBeDefined();+ } finally {+ await browser.close();+ }+ });+test.concurrent('should pass launch options to browser', async () => {const plugin = new PuppeteerPlugin(puppeteer);