What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To capture a protected page with Puppeteer, first establish an authorized session—by completing the site’s normal login flow, restoring valid session cookies, or supplying HTTP authentication when the server specifically requests it. Then navigate to the protected URL, verify that the authenticated content actually loaded, and call page.screenshot(). For a full-page image, set fullPage: true.
Choose how Puppeteer will authenticate
Most pages described as “behind a login” use an application’s HTML login form and session, not HTTP Basic or Digest authentication. Choose the mechanism that matches how the site grants access:
| Approach | Use it when | Important caveat |
|---|---|---|
| Automate the site’s login form | The protected page uses the site’s normal web-app sign-in. | Selectors, redirects, MFA, consent prompts, and anti-automation controls vary by site. |
| Restore authorized cookies | You already have a legitimately obtained session and need to reuse it. | Cookies expire, are scoped to domains and paths, and can grant account access. Puppeteer’s current guidance uses browser or browser-context cookie APIs rather than the deprecated page-level setter. |
page.authenticate() |
The server requests HTTP authentication credentials. | It is not a substitute for filling in an ordinary HTML login form, and it enables request interception. |
Only automate accounts and sessions you are authorized to use. Do not print or expose session cookies: anyone who obtains a valid session cookie may be able to access the account.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsAutomate the site’s normal login flow
The following example shows the sequence for a typical form-based login. Replace the example URL, selectors, credentials, and authenticated-page marker with the site’s actual values. It is a pattern, not a universal login script: Puppeteer cannot know a site’s form structure, MFA flow, or success condition.
#1 Best Overall
- Compatible with Nintendo Switch 2’s new GameChat mode
- Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
- Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
- Built-In Mic: The built-in microphone lets others hear you clearly during video calls
- Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.setViewport({ width: 1440, height: 1000 });
await page.goto('https://example.com/login', {
waitUntil: 'domcontentloaded',
});
await page.locator('input[name="email"]').fill(process.env.SITE_USERNAME);
await page.locator('input[name="password"]').fill(process.env.SITE_PASSWORD);
await page.locator('button[type="submit"]').click();
// Replace with a marker that appears only after successful sign-in.
await page.waitForSelector('[data-testid="account-home"]');
const response = await page.goto('https://example.com/account/private', {
waitUntil: 'domcontentloaded',
});
if (response && response.status() >= 400) {
throw new Error(`Destination returned HTTP ${response.status()}`);
}
// Replace with a marker unique to the protected destination.
await page.waitForSelector('[data-page="private-account"]');
await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
await browser.close();
}
The selectors above are illustrative. Store credentials outside source code, for example in environment variables, and do not save screenshots containing sensitive information to a publicly accessible location. Wait for a marker that is specific to the protected page, not merely a generic navigation event or a shared site header.
Restore an authorized session with cookies
If a valid session was obtained through an authorized sign-in, you can set its cookies in a browser context before visiting the destination. Use the browser or browser-context cookie methods documented for your installed Puppeteer version; the page-level setCookie API is deprecated. Cookie fields and constraints depend on the site, including domain, path, expiry, and security attributes.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const context = browser.defaultBrowserContext();
await context.setCookie({
name: process.env.SESSION_COOKIE_NAME,
value: process.env.SESSION_COOKIE_VALUE,
domain: 'example.com',
path: '/',
secure: true,
httpOnly: true,
});
const page = await context.newPage();
const response = await page.goto('https://example.com/account/private', {
waitUntil: 'domcontentloaded',
});
if (response && response.status() >= 400) {
throw new Error(`Destination returned HTTP ${response.status()}`);
}
await page.waitForSelector('[data-page="private-account"]');
await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
await browser.close();
}
This illustrates the API shape; it does not mean every site accepts one cookie with those attributes. Supply the actual cookie data and scope required by the site, and protect it like a password. Consult the Puppeteer cookie guide and your installed version’s API documentation for the current method signature.
Rank #2
- Compatible with Nintendo Switch 2’s new GameChat mode
- Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
- The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
- C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
- The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.
Use HTTP authentication only for HTTP-auth protected pages
When the server itself requests HTTP authentication, call page.authenticate() before navigation:
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.authenticate({
username: process.env.HTTP_USERNAME,
password: process.env.HTTP_PASSWORD,
});
const response = await page.goto('https://example.com/private', {
waitUntil: 'domcontentloaded',
});
if (response && response.status() >= 400) {
throw new Error(`Destination returned HTTP ${response.status()}`);
}
await page.waitForSelector('[data-page="private-content"]');
await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
await browser.close();
}
Puppeteer documents that this method turns on request interception behind the scenes, which may affect performance. Passing null disables authentication. It is intended for HTTP authentication challenges, not a website’s normal sign-in form. See the Page.authenticate() API reference.
Verify the destination, then choose the screenshot
A successful navigation does not prove that the browser reached the intended authenticated page. A site may redirect an expired session to its login screen, or return an error page. Check the final URL, inspect the main-resource response when available, and wait for a destination-specific marker before taking the image. In headless shell, navigation may resolve for valid HTTP error responses such as 404 or 500, so check response.status() rather than treating a resolved goto() as success.
Rank #3
- 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
- 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
- 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
- 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
- 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
Puppeteer’s screenshot API supports a file path, image type, full-page capture, and region clipping. fullPage defaults to false. The output type can be inferred from the path extension; quality applies only to formats that support it, not PNG.
await page.screenshot({
path: 'page.png',
fullPage: true,
});
For a cropped region, pass a clip rectangle to page.screenshot(). For an element, use its handle instead:
const target = await page.waitForSelector('[data-testid="invoice"]');
if (!target) throw new Error('Invoice element not found');
await target.screenshot({ path: 'invoice.png' });
Puppeteer scrolls an element into view when needed. The element must still be attached to the DOM when the screenshot is taken; a detached handle causes an error. See Puppeteer’s screenshot guide, Page.screenshot() options, and ElementHandle.screenshot().
Rank #4
- 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
- Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
- Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
- Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
- High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
Wait for application readiness, not just navigation
waitUntil: 'domcontentloaded' waits for the document’s DOM to be parsed, but it does not establish that application data, images, or client-side rendering are complete. Prefer an app-specific signal: a unique selector, a known state change, or another condition the site exposes. If a required image is lazy-loaded below the fold, scrolling it into view or using full-page capture may be necessary; verify the actual result because site rendering behavior varies.
Puppeteer coordinates screenshots with certain page and context operations, but that coordination is not a substitute for waiting on the page’s own content. A fixed delay can help with a known, bounded animation or delayed render, but a selector or explicit state condition is generally more reliable than guessing a sleep duration.
Recommended Free Tools
Troubleshoot common failures
- The screenshot shows the login page. The session may not have been established, may have expired, or the login flow may have redirected back. Check the final URL and wait for a unique authenticated-page marker before capture.
- The destination returns an error but
goto()did not throw. Inspect the response status. Headless shell can resolve navigation for valid HTTP error statuses, including 404 and 500. - The image is blank or missing application content. Navigation completion may precede client-side rendering or data loading. Wait for the page’s unique content marker or a site-specific ready state.
- Cookie restoration does not sign in. Confirm the cookie is current and that its domain, path, security attributes, and required companion cookies match the site’s session requirements. A cookie for a different host or an expired session will not provide access.
- HTTP credentials do not work on a normal sign-in form. Use the site’s form flow instead;
page.authenticate()handles HTTP authentication challenges. - Element screenshot reports a detached node. The page replaced or removed the target after it was found. Locate it again after the update and capture while it remains attached.
- The screenshot misses content at the bottom. Set
fullPage: truerather than relying on the default viewport-sized capture.
Or skip the browser setup
For a one-request screenshot, ScreenshotNeo accepts a URL and returns an image or PDF. It is a screenshot API and MCP server from Yorker Media. A request to a protected page still needs whatever access the service supports; do not assume it can access an account merely because you provide a URL.
Best Value
- Compatible with Nintendo Switch 2’s new GameChat mode
- HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
- Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
- Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
- Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video
Example cURL request for a public URL (replace the target URL as needed; the API key is required):
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 API documentation for request options. ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing outcome. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.
Sign up free for 1,000 screenshots a month with no card.
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 minuteFrequently Asked Questions
Can Puppeteer take a full-page screenshot after login?
Yes. After verifying the authenticated destination, call page.screenshot({ path: 'page.png', fullPage: true }).
Why does Puppeteer capture the login page instead of the protected page?
The session may be missing or expired, or the site may have redirected to sign-in. Check the final URL and wait for a selector unique to the protected content.
Does page.authenticate() log in to any website?
No. It handles HTTP authentication challenges. For a normal web-app login, automate the site’s own form or restore a valid authorized session.
Quick Recap
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.

