Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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 page behind a login with Apify, run a browser in an Actor, authenticate with an account authorized to access the site, navigate to the protected page, wait for the content you need, and save the screenshot to an Apify key-value store. The login flow and selectors are site-specific; the example below is a starting point, not a universal login script.

What you need before capturing a protected page

  • An Apify Actor project with a supported browser-automation library. Apify documents screenshot capture with Puppeteer and says a similar example can be implemented with Playwright; choose the library already supported by your project rather than assuming one is universally better.
  • Permission to use the account and access the target page. Check the site’s current terms and access rules; authentication does not itself grant permission to automate or capture a page.
  • The target site’s actual login steps and selectors. Fields, redirects, consent screens, multifactor prompts, and anti-automation controls vary. Apify Academy’s login lesson uses Yahoo as a teaching example, not a universal selector map.

Apify’s JavaScript SDK screenshot documentation: Capture a screenshot. Login and session examples: Log in to a website. Check the API methods against the SDK version installed in your Actor.

Capture a logged-in screenshot in an Apify Actor

The workflow has five parts: launch the browser, perform the site’s login flow, open the protected URL, wait for the relevant state, and write the image to key-value storage. Replace the illustrative selectors and environment-variable names with those for your project and target site. Keep credentials in protected Actor input or secrets rather than committing them in source.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Launch a browser. Use the browser and runtime setup supported by the SDK version in your project.
  2. Log in. Fill the site’s real fields and submit the form. Handle redirects, MFA, consent, or other expected steps as needed; do not bypass access controls.
  3. Open the protected page. Navigate only after the login flow has completed and the browser has an authenticated session.
  4. Wait for the page state you need. Wait for navigation and, for dynamic pages, a selector that identifies the specific content to capture.
  5. Capture and store the image. Save the screenshot buffer with an image content type in the Actor’s key-value store.

Apify’s SDK example uses Puppeteer and notes that it would look almost the same with Playwright. The following is a Puppeteer-shaped outline; confirm imports and storage calls for your installed SDK generation before using it as an Actor entry point:

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
import { Actor } from 'apify';
import puppeteer from 'puppeteer';

await Actor.init();

const input = await Actor.getInput();
const loginUrl = input.loginUrl;
const pageUrl = input.pageUrl;
const username = input.username;
const password = input.password;

if (!loginUrl || !pageUrl || !username || !password) {
  throw new Error('Provide loginUrl, pageUrl, username, and password in Actor input.');
}

const browser = await puppeteer.launch({ headless: true });
try {
  const page = await browser.newPage();
  await page.goto(loginUrl, { waitUntil: 'domcontentloaded' });

  // Replace these example selectors with the target site's real login controls.
  await page.locator('input[name="username"]').fill(username);
  await page.locator('input[name="password"]').fill(password);
  await Promise.all([
    page.waitForNavigation({ waitUntil: 'domcontentloaded' }),
    page.locator('button[type="submit"]').click(),
  ]);

  await page.goto(pageUrl, { waitUntil: 'domcontentloaded' });
  // Replace with a selector that proves the content you need is present.
  await page.waitForSelector('[data-page-ready="true"]');

  const image = await page.screenshot({ fullPage: true, type: 'png' });
  await Actor.setValue('logged-in-page.png', image, { contentType: 'image/png' });
} finally {
  await browser.close();
  await Actor.exit();
}

This illustrates the sequence, not a guarantee that every site submits a conventional form or triggers a full-page navigation. Some applications use client-side transitions; in those cases, wait for an authenticated marker or the target content instead of relying on waitForNavigation. The exact screenshot and storage APIs can vary with SDK generation, so use the matching Apify documentation for the version your project runs.

Wait for the right content before taking the screenshot

A browser’s load event is not proof that a modern page is visually complete. Apify’s waiting guide recommends waiting for navigation before capturing a loaded page. For pages that fetch content asynchronously, also wait for a specific selector or state that matters to your screenshot.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • Use a navigation wait when login submission or a link causes a document navigation.
  • Use a target selector when a single content area must appear before capture.
  • Use a delay only when you have a known, justified timing need; a fixed pause can still be too short or needlessly long.
  • For long pages, use full-page capture when the whole document is needed. If content loads only as it enters the viewport, scroll or otherwise trigger it before capturing and verify that the resulting image includes it.

Apify’s screenshot example shows the capture and key-value storage pattern. Store the returned image buffer with an appropriate image content type, such as image/png, and check the Actor’s key-value store for the output.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reuse login cookies when a later run needs the session

Apify Academy demonstrates retrieving cookies from a Playwright browser context or a Puppeteer page. Cookies can let a later browser context continue an authenticated session, but they are session credentials: restrict access, do not print them to logs, and do not expose them in source code or shared output.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Cookie reuse is not a substitute for a reliable login flow. Sessions expire or may be bound to other state, and the target site can require renewed authentication or MFA. If a saved session no longer works, return to the authorized login flow rather than assuming a screenshot failure is caused by the capture step.

Where Apify saves the screenshot and who can access it

Apify key-value stores hold arbitrary files and records, making them a suitable place for screenshot output. Resource access depends on account configuration and explicit permissions, so check the settings for the store and Actor run instead of assuming the image is public or private. Apify documents key-value stores and resource access.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Troubleshoot common capture failures

Symptom Likely cause What to check
The screenshot shows the login page The login did not complete, the session was not retained, or the protected URL redirected back to sign-in. Confirm the login selectors and submit behavior for the actual site, inspect the final URL and authenticated page state, and account for MFA or consent steps.
The Actor times out while waiting for navigation The app may use a client-side transition instead of a full document navigation, or the submit action did not succeed. Verify the submit result. For a single-page app, wait for a visible authenticated marker or target selector instead of a navigation event.
The image is blank or missing key content The capture happened before the relevant asynchronous content rendered, or the expected content never appeared. Wait for a selector specific to the needed content and inspect whether that selector appears before taking the screenshot.
Cookie reuse stops working The session may have expired or the site may require renewed authentication. Run the authorized login flow again and avoid logging or exposing session cookies.
The screenshot cannot be retrieved The key-value-store output or its permissions may not match expectations. Confirm the Actor wrote the image under the expected key with an image content type, then inspect the store’s configured access permissions.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot API rather than an Actor that signs into a protected site, ScreenshotNeo is an alternative for website screenshot capture. Its one-request API returns an image or PDF, but it does not replace the custom authenticated browser workflow above for pages requiring a login.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a page the API can access, make one GET request (see the ScreenshotNeo API documentation):

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed; an MCP server lets AI agents take screenshots; and 1,000 screenshots a month are free with no card, with paid plans starting at $5 for 3,000. Sign up for free.

Frequently Asked Questions

Can I use Playwright instead of Puppeteer in an Apify Actor?

Yes. Apify’s screenshot example says a similar implementation can be made with Playwright; use the library and API version supported by your project.

Does this workflow work with every login-protected website?

No. Authentication steps, selectors, MFA, session behavior, and automation controls differ by site, so adapt the flow and use only accounts and pages you are authorized to access.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can ScreenshotNeo capture a page that requires my login?

The one-call example is for a page the API can access; it does not replace a custom browser workflow for a protected page that requires authentication.

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.