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.

Minor fix in defaultViewport option for launchPuppeteer()

Jan Curn855bcffaa3f0
diff --git a/src/puppeteer.js b/src/puppeteer.js
index 4f5b3d5bc..a8236694b 100644
--- a/src/puppeteer.js
+++ b/src/puppeteer.js
@@ -168,6 +168,8 @@ const getPuppeteerOrThrow = () => {
* <li>
* Sets <code>defaultViewport</code> Puppeteer option (if not already set)
* to a more reasonable default for screenshots and debugging.
+ * You can set `options.defaultViewport` to `null` if you prefer to let Puppeteer
+ * choose the default viewport size.
* </li>
* </ul>
*
@@ -222,7 +224,7 @@ export const launchPuppeteer = (options = {}) => {
sessionParamName: 'options.apifyProxySession',
});
}
- if (!optsCopy.defaultViewport) {
+ if (optsCopy.defaultViewport === undefined) {
optsCopy.defaultViewport = LAUNCH_PUPPETEER_DEFAULT_VIEWPORT;
}