Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteIn Puppeteer, a Page is a tab-like page, a viewport is the area where that page renders, and a native browser window has its own outer position, size, and state. Use Browser.setWindowBounds() to move or maximize a native window, Page.resize() to request a content area, and Page.setViewport() to set or emulate the page viewport. These controls are related, but they are not interchangeable.
Choose the Puppeteer API for the job
| Need | API | Controls | Important caveat |
|---|---|---|---|
| Move, maximize, restore, or inspect a native window | Browser.getWindowBounds() and Browser.setWindowBounds() |
Window position, bounds, and state | Use the relevant window ID; window management is demonstrated with a window-type page. Puppeteer Window management guide |
| Request exact page content dimensions | Page.resize() |
Browser window size derived from desired content dimensions | Clear a constraining viewport when appropriate and wait for resizing to finish. Puppeteer Window management guide |
| Test responsive layout or device-like rendering | Page.setViewport() |
Page viewport | Changes to isMobile or hasTouch can reload the page. Page.setViewport() API |
| Keep sessions and storage separate | Browser.createBrowserContext() and its pages |
Cookies and local storage boundaries | Closing a context closes its pages; popups belong to their opener’s context. BrowserContext API |
Puppeteer describes the native-window approach directly: “Use Puppeteer’s Browser.getWindowBounds andBrowser.setWindowBounds methods to manage browser window position and state.” Check the API version installed in your project: current surfaced documentation includes versions 25.9.0 and 25.12.0, and APIs can evolve.
Start a browser and create a page
For a typical automation task, launch Chromium and open a page. A regular page is sufficient for navigation and viewport work; request a window-type page when you need to work with native window bounds.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await browser.pages());
await browser.close();
})();
This CommonJS example assumes Puppeteer is installed in the project and a local browser can be launched. Set headless: false when you need a visible native window. Close a browser launched for this task when finished; if Puppeteer connected to a browser owned by another controller, use browser.disconnect() instead so that the browser process and its pages remain running. See Puppeteer Browser management.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute#1 Best Overall
How to resize, move, maximize, or restore a Puppeteer browser window
Use a window-type page, obtain its window ID, and then read or set the native window bounds. The window ID is what connects a Puppeteer page to the browser window you intend to control.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage({ type: 'window' });
const windowId = await page.windowId();
const currentBounds = await browser.getWindowBounds(windowId);
console.log('Current bounds:', currentBounds);
await browser.setWindowBounds(windowId, {
left: 80,
top: 60,
width: 1100,
height: 800,
windowState: 'normal',
});
await browser.setWindowBounds(windowId, { windowState: 'maximized' });
// Restore the window to its normal state:
await browser.setWindowBounds(windowId, { windowState: 'normal' });
await browser.close();
})();
Use getWindowBounds() to inspect the current window before deciding what to change. Set the position and dimensions for a normal window, or set windowState to 'maximized' or 'normal' to change state. Consult the official window-management guide for the version-specific shape of returned bounds and supported options.
Set the content area to exact dimensions
If the requirement is a specific content width and height—not an outer window size—use Page.resize({ contentWidth, contentHeight }). A default viewport can constrain the resulting window, so clear it first when that is appropriate. Resizing is asynchronous; wait for the resize event before measuring the inner dimensions.
Rank #2
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage({ type: 'window' });
await page.setViewport(null);
await page.resize({ contentWidth: 600, contentHeight: 400 });
await page.evaluate(() => new Promise(resolve => {
window.addEventListener('resize', resolve, { once: true });
}));
const dimensions = await page.evaluate(() => ({
innerWidth: window.innerWidth,
innerHeight: window.innerHeight,
outerWidth: window.outerWidth,
outerHeight: window.outerHeight,
}));
console.log(dimensions);
await browser.close();
})();
The outer window includes browser chrome, so its dimensions will differ from the content area. The official guide shows one example environment where a 600×400 inner size corresponded to a 600×487 outer size; that is an example, not a universal browser-chrome allowance. See Window management for the documented resize pattern and example.
Set a viewport for responsive layout or emulation
Page.setViewport() sets the page’s viewport and can be used independently for each page. Set it before navigation when possible, particularly when testing layout behavior at a chosen viewport size.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 390, height: 844, deviceScaleFactor: 1 });
await page.goto('https://example.com');
console.log(await page.evaluate(() => ({
width: window.innerWidth,
height: window.innerHeight,
})));
await browser.close();
})();
A viewport is not the native window’s outer width and height. Also account for the API note that changing isMobile or hasTouch can trigger a page reload. See Page.setViewport() API reference.
Rank #3
Open and inventory multiple tabs or windows
One Browser can have multiple Page instances. Create additional pages for tabs or use a window-type page when the task requires native window management. browser.pages() returns open pages across browser contexts; by default it omits non-visible pages such as background pages. Its optional includeAll flag includes those pages.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const first = await browser.newPage();
const second = await browser.newPage();
await Promise.all([
first.goto('https://example.com'),
second.goto('https://example.org'),
]);
const visiblePages = await browser.pages();
console.log('Visible pages:', visiblePages.length);
// Include non-visible pages when needed:
const allPages = await browser.pages({ includeAll: true });
console.log('All pages:', allPages.length);
await browser.close();
})();
Page enumeration and its background-page behavior are documented in the Browser.pages() API reference. A Page represents a single tab or extension background page; see the Page class reference.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use contexts when pages need independent sessions
Pages in one browser context share that context’s browser storage. Create separate browser contexts when workflows need isolated cookies and local storage. A popup opened by a page remains in the same context as its opener, and closing a context closes the pages it contains.
Rank #4
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const accountA = await browser.createBrowserContext();
const accountB = await browser.createBrowserContext();
const pageA = await accountA.newPage();
const pageB = await accountB.newPage();
await Promise.all([
pageA.goto('https://example.com'),
pageB.goto('https://example.com'),
]);
// Closing a context closes the pages created in it.
await accountA.close();
await accountB.close();
await browser.close();
})();
Use the BrowserContext API reference for context behavior and Browser management for browser lifecycle details.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot window and page sizing
- The viewport changed, but the browser window did not:
setViewport()controls the page rendering area, not native window bounds. Use the window-bounds methods for position, size, or state. - The content area is smaller or larger than expected: Browser chrome contributes to outer dimensions. Use
Page.resize()when content dimensions are the requirement, and measure inner dimensions after the asynchronous resize completes. - The requested content size is not taking effect: A default viewport may constrain the window. Try
page.setViewport(null)beforepage.resize(), as in the official guide. - A mobile or touch viewport change reloads the page: This can occur when changing
isMobileorhasTouch. Configure the viewport before navigating when possible. API note - The window API cannot identify the target: Obtain the window ID from the relevant window-type page with
await page.windowId()and pass that ID to the bounds methods. - A page is missing from
browser.pages(): The default list excludes non-visible pages such as background pages. Trybrowser.pages({ includeAll: true })if those pages are needed. API reference - Closing a context also closes pages you still need: That is expected context behavior. Keep the context open for the lifetime of its pages, or create those pages in a different context.
- The browser unexpectedly stays open after the script:
browser.disconnect()detaches Puppeteer but intentionally leaves the browser and pages running. Usebrowser.close()when the task owns the browser and should shut it down. Browser management guide
Or skip the browser setup
If your goal is a website screenshot rather than interactive browser-window control, ScreenshotNeo returns a screenshot or PDF with one GET request. It is a screenshot API and MCP server, not a replacement for Puppeteer’s tab, viewport, or native-window controls.
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo documentation for API options. Cookie banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.
Free tools Windows power users keep installed
One-click scans. No signup required.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

