How do I run Puppeteer with the system’s Chrome on macOS? My script opens a fixed window size while content remains constrained. How can I fully resize it?
Considering Puppeteer’s default behavior, it is important to note that setting the window size through the launch arguments may not always correctly target the viewport dimensions. In my experience, after launching the browser you can adjust the viewport explicitly. For example, including a command like page.setViewport({ width: 1280, height: 800 }) right after creating the page instance often resolves scrolling and sizing issues. Also, ensure your Chrome version and Puppeteer are compatible, as discrepancies there can sometimes cause unexpected behavior. Experimentation with both settings usually provides a solution.
I once faced a similar problem when experimenting with Puppeteer and a device-installed Chrome. In my case, the window-size argument was applied only to the browser window, without affecting the actual viewport. The solution was to set the viewport dimensions explicitly by calling page.setViewport immediately after creating the page instance. This ensures that the content area matches your intended dimensions. Additionally, I found that checking for conflicts with other launch parameters and ensuring version harmony between Puppeteer and Chrome can also be helpful.
try using defaultviewport: null in your launch opts so chrome doesnt override ur window dimensions. sometimes puppeteer forces its own size when a default is provided, so letting it inherit the system size might fix the issue. hope this helps out