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 screenshot a protected page with Puppeteer, authenticate in the way the site actually requires, wait for a site-specific sign-in indicator, and only then capture the page. For a normal website form, submit its real login fields; for an existing session, set a valid cookie before navigating; for HTTP authentication, use page.authenticate(). These are different authentication methods, not interchangeable shortcuts.
Choose the authentication method the site uses
Use this workflow only for accounts and pages you are authorized to access. Login selectors, multifactor steps, cookie requirements, and indicators of a successful login are specific to each site. The examples below use placeholders for site-specific values; replace them with the target site’s actual form selectors, URLs, and signed-in marker. Do not put real credentials or reusable session cookies in source code.
Standard website login form
Most sites use an HTML form or application interface. Navigate to the login page, fill its actual username and password fields, submit, then verify a signed-in state. page.authenticate() is not a helper for filling a normal web form; Puppeteer documents it for HTTP authentication instead. See the Page.authenticate() reference.
Free tools Windows power users keep installed
One-click scans. No signup required.
Existing session cookie
If you already have a valid session cookie for the target site, set it in the browser context before opening the protected URL. Cookie domain, expiry, and security attributes must be appropriate for that site; Puppeteer cannot make an expired or wrong-domain session valid. Current Puppeteer documentation provides cookie management through browser or browser-context APIs. Page-level cookie methods are deprecated in favor of those APIs. See the cookie guide, Browser.setCookie(), and CookieData.
#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
HTTP authentication
For a server that challenges with HTTP authentication, call page.authenticate({ username, password }) before navigating. This is distinct from a site’s visible login form. Puppeteer notes that this mechanism turns on request interception behind the scenes, which may affect performance. See the API reference.
Log in, confirm access, and capture the page
This CommonJS example demonstrates an ordinary form login. Install Puppeteer in your project, then set the environment variables and replace the example selectors and marker with those used by your site. The marker should be an element that appears only after successful authentication, such as an account control or protected-page heading.
- Set configuration securely. Provide
LOGIN_URL,PROTECTED_URL,USERNAME, andPASSWORDthrough your environment or secret manager. SetUSER_SELECTOR,PASS_SELECTOR,SUBMIT_SELECTOR, andSIGNED_IN_SELECTORto real selectors from the target site. - Navigate to login and fill the form. Selectors such as
#usernamebelow are illustrative only; they are not universal. - Wait for the submit result and a signed-in signal. If submission triggers document navigation, start
waitForNavigation()at the same time as the click. This avoids a race in which the navigation begins before the wait is registered. - Open the protected URL if needed, verify access again, then save the screenshot. A completed document load alone does not prove that authentication succeeded or that client-rendered content is ready.
const puppeteer = require('puppeteer');
async function main() {
const required = [
'LOGIN_URL', 'PROTECTED_URL', 'USERNAME', 'PASSWORD',
'USER_SELECTOR', 'PASS_SELECTOR', 'SUBMIT_SELECTOR', 'SIGNED_IN_SELECTOR'
];
for (const name of required) {
if (!process.env[name]) throw new Error(`Set ${name} before running this script`);
}
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.goto(process.env.LOGIN_URL, { waitUntil: 'domcontentloaded' });
await page.waitForSelector(process.env.USER_SELECTOR);
await page.type(process.env.USER_SELECTOR, process.env.USERNAME);
await page.type(process.env.PASS_SELECTOR, process.env.PASSWORD);
// Use Promise.all when submitting causes document navigation.
await Promise.all([
page.waitForNavigation({ waitUntil: 'domcontentloaded' }),
page.click(process.env.SUBMIT_SELECTOR)
]);
// Replace this with a marker that uniquely indicates signed-in state.
await page.waitForSelector(process.env.SIGNED_IN_SELECTOR, { timeout: 15000 });
if (new URL(page.url()).origin !== new URL(process.env.PROTECTED_URL).origin) {
await page.goto(process.env.PROTECTED_URL, { waitUntil: 'domcontentloaded' });
}
// Verify the protected page has rendered for the authenticated user.
await page.waitForSelector(process.env.SIGNED_IN_SELECTOR, { timeout: 15000 });
await page.screenshot({ path: 'page.png' });
} finally {
await browser.close();
}
}
main().catch(error => {
console.error(error);
process.exitCode = 1;
});
If the site’s submit action does not cause a document navigation—for example, a single-page app—do not wait for a navigation that never comes. Click the submit control and wait for the site’s signed-in marker or other reliable application state. For client-side URL changes, Puppeteer’s navigation wait treats History API changes as navigation, but a content marker remains a useful confirmation. See Frame.waitForNavigation() and the Page API.
Rank #2
- 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)
Restore a session with a cookie
Use a cookie only when you have a valid session cookie for the same site and are authorized to use it. Prefer a chosen browser context when managing isolated sessions. Supply cookie data suitable for the target domain and its security and expiry requirements; never commit the cookie value to a repository.
const puppeteer = require('puppeteer');
async function main() {
const browser = await puppeteer.launch({ headless: true });
try {
const context = await browser.createBrowserContext();
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();
await page.goto('https://example.com/account', { waitUntil: 'domcontentloaded' });
await page.waitForSelector(process.env.SIGNED_IN_SELECTOR, { timeout: 15000 });
await page.screenshot({ path: 'account.png' });
} finally {
await browser.close();
}
}
main().catch(error => {
console.error(error);
process.exitCode = 1;
});
Replace example.com, the protected URL, cookie name, value, and marker with values for the actual site. Some sites require additional cookies or attributes, or do not accept a copied session in a new browser context. Consult the site’s session rules and Puppeteer’s cookie guide.
Use HTTP authentication when the server requests it
For HTTP authentication rather than a normal page form, authenticate before requesting the protected URL:
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.
const puppeteer = require('puppeteer');
async function main() {
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.authenticate({
username: process.env.HTTP_USERNAME,
password: process.env.HTTP_PASSWORD
});
await page.goto('https://example.com/protected', { waitUntil: 'domcontentloaded' });
await page.waitForSelector(process.env.SIGNED_IN_SELECTOR, { timeout: 15000 });
await page.screenshot({ path: 'protected.png' });
} finally {
await browser.close();
}
}
main().catch(error => {
console.error(error);
process.exitCode = 1;
});
Use the target’s actual URL and a meaningful protected-content marker. HTTP authentication is not a substitute for filling a site’s login form.
Pick the screenshot scope and output
page.screenshot() captures the current viewport by default. Set fullPage: true to capture the full document, or use an element screenshot when only one component matters. Puppeteer scrolls a hidden element into view for an element screenshot. Screenshot options also support a clip rectangle, file path, and image type; PNG is the default. A quality setting from 0 to 100 applies to formats that support it, not PNG. See the screenshots guide and ScreenshotOptions.
// Current viewport, PNG by default
await page.screenshot({ path: 'viewport.png' });
// Entire document
await page.screenshot({ path: 'full-page.png', fullPage: true });
// One element; replace the selector with a real page element
const panel = await page.waitForSelector('[data-report-panel]');
await panel.screenshot({ path: 'report-panel.png' });
// A rectangular region (coordinates and dimensions are CSS pixels)
await page.screenshot({
path: 'region.png',
clip: { x: 40, y: 80, width: 900, height: 600 }
});
// JPEG with a supported quality value
await page.screenshot({ path: 'page.jpg', type: 'jpeg', quality: 85 });
- Use viewport capture for the visible screen at the page’s current viewport size.
- Use full-page capture for a long document; ensure lazy-loaded content has had a chance to render before capturing.
- Use an element screenshot to isolate a card, chart, or other component without saving the entire page.
- Choose PNG for lossless output; quality does not apply to PNG. Use a supported quality value for JPEG or another applicable format when file size matters.
Or skip the browser setup
If you already have authorized access but do not want to manage Puppeteer, cookies, or browser setup, ScreenshotNeo provides a website screenshot API and MCP server. Its capture flow accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. A free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
One GET request returns a screenshot or PDF. See the ScreenshotNeo documentation for authentication and available options. This request illustrates a public page; use only access methods you are authorized to use for protected content.
Rank #4
- 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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for ScreenshotNeo to get 1,000 screenshots a month free with no card.
Troubleshoot failed or incorrect captures
The screenshot shows the sign-in page
- Check the final page URL and wait for a site-specific authenticated marker before capture.
- Confirm that the form selectors point to the live login controls and that the site did not require another step, such as multifactor authentication.
- For cookie login, check that the cookie is valid for the protected domain and has not expired.
The click sometimes misses the redirect
Register waitForNavigation() before triggering the click by placing both in Promise.all(). If the application does not navigate, wait for the signed-in content instead.
The cookie has no effect
Check its domain, path, expiry, and security attributes against the target site’s requirements. A cookie from another domain or an expired session cannot establish access. Use current browser- or context-level cookie methods rather than deprecated page-level methods.
Best Value
The URL changes but the expected content is missing
History API URL changes count as navigation, but navigation is not proof that protected content has finished rendering. Wait for the actual content or account marker you expect to appear.
The screenshot differs across installations
The official Puppeteer pages referenced here display version 25.12.0 for the screenshot guide, cookie guide, and related API references; some related pages may display older version labels. Check the documentation matching the Puppeteer version installed in your project when an option or behavior differs.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsCost, reliability, and security considerations
- There is no universal login selector or universal sign-in marker. Treat both as site-specific configuration, and fail clearly on timeout rather than saving a likely login screen.
- A navigation wait only addresses navigation timing; the authenticated marker addresses whether the page reached the state needed for capture.
- HTTP authentication uses request interception internally and may affect performance, according to Puppeteer’s API reference.
- Keep passwords and session cookies in environment variables or a secret manager. A saved session cookie can grant account access, so do not publish it, log it, or check it into source control.
- Use a fresh browser context when you need session isolation, and close the browser in a
finallyblock so failures do not leave browser processes running.
Frequently Asked Questions
Does Puppeteer support screenshots of pages after login?
Yes. Authenticate using the target site’s supported flow, verify a site-specific signed-in state, and then use the page or element screenshot API.
Can I use page.authenticate() for a username-and-password form?
No. Puppeteer documents it for HTTP authentication challenges. A normal website form must be filled and submitted using the site’s actual controls.
Should I use Puppeteer’s page-level cookie methods?
Current Puppeteer documentation marks page-level cookie methods deprecated; use browser- or browser-context-level cookie management.
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.

