Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Screenshot a Logged-In Page with Selenium and a Chrome User Data Directory

Configure Chrome with a dedicated user data directory, verify the authenticated page, and save a PNG with Selenium Python.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pass Chrome a dedicated profile directory with Selenium’s --user-data-dir option, open the page, verify an element that appears only when you are signed in, and save the current browser window as a PNG. Reusing a profile can provide its browser state, but it does not guarantee the site’s session is still valid.

Python example: open the profile and save a screenshot

Install Selenium in the environment that will run the script, then replace the profile path, target URL, and authentication check with values for your site. The selector below is illustrative; use a stable element that exists only in the authenticated view.

As an Amazon Associate I earn from qualifying purchases.

from pathlib import Path
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait

profile_dir = Path("/absolute/path/to/selenium-chrome-profile")
screenshot_path = Path("/absolute/path/to/output/page.png")
screenshot_path.parent.mkdir(parents=True, exist_ok=True)

options = webdriver.ChromeOptions()
options.add_argument(f"--user-data-dir={profile_dir}")

driver = webdriver.Chrome(options=options)
try:
    driver.get("https://example.com/account")

    # Replace with a stable element visible only when signed in.
    WebDriverWait(driver, 15).until(
        lambda d: d.find_element("css selector", "[data-authenticated]")
    )

    saved = driver.save_screenshot(str(screenshot_path))
    if not saved:
        raise OSError(f"Could not write screenshot to {screenshot_path}")
finally:
    driver.quit()

Selenium’s Chrome documentation lists --user-data-dir=... as a Chrome argument. The Python WebDriver API describes save_screenshot() as saving the current window to a PNG file and returning a boolean result; check that result and use a writable path.

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

Set up profile state and authentication

Use an explicit, dedicated directory

Choose an absolute path writable by the machine running Chrome. A dedicated automation profile is usually easier to manage than trying to share the profile of an open desktop browser. Chrome needs to be able to read and write that directory. Avoid concurrent runs against the same profile; use a separate directory for each parallel job.

#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black | 1080p with auto-light correction, built-in mic, privacy shutter, USB-A, compatible with Teams, Google Meet, Zoom and more
  • 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

Sign in through an allowed flow

The directory tells Chrome which profile state to use; it does not authenticate a user by itself. Sign in to that profile through an allowed login flow, or configure an approved test account. Sessions can expire or be revoked, and a site may ask for additional verification. Do not treat possession of a profile directory as proof that the page is signed in.

Verify the authenticated page before capture

A completed navigation is not evidence that login succeeded or that a client-rendered page is ready. Wait for a site-specific account heading, navigation item, or other authenticated-only element. If the wait times out, stop and inspect the page state rather than saving a login screen as though it were the intended result.

Rank #2
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera | USB Type-A & A-to-C Adapter, Fixed Focus, Plug&Play for Zoom/Teams/Facetime/YouTube/Google Meet/Switch 2 Camera, 2025 Version
  • 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)

Selenium’s JavaScript Chrome driver documentation says new sessions use a clean profile unless configured through Options. That and Chrome’s user-data-directory argument explain how to select profile state, not whether a particular website will continue to accept its session.

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

Profile directory or cookies?

Approach What it supplies Important limit
Chrome user data directory Browser profile state selected at Chrome startup with --user-data-dir. The site session may be expired or otherwise rejected; the browser host must have access to the directory.
WebDriver cookies Cookies that you inspect or set for the current domain. Navigate to the cookie’s domain before adding it. Cookies may not represent all state needed for a site’s login.

The Selenium Project’s cookie guide notes that cookies are commonly used to recognize users and load stored information, and that a cookie must be added while on a domain where it is valid. Cookies can be useful for specific workflows, but they are not necessarily interchangeable with a complete browser profile.

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【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.

What the screenshot includes

save_screenshot() captures the current browser window, not automatically the entire document. If content is below the visible viewport, it may not appear in the image. Set an appropriate window size when you need a larger viewport; for a full-document capture, use a separately verified method suitable for your browser and Selenium binding rather than assuming this call scrolls and stitches the page.

Browser and runtime compatibility

Selenium’s Chrome documentation, last modified July 17, 2026, says Selenium 4 is compatible with Chrome v75 and greater and that Chrome and ChromeDriver major versions should match. Treat this as the page’s stated guidance, not a guarantee for every managed browser, container, or installed build. Check the versions and how the runtime provides the browser and driver.

Rank #4
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black | Auto-Light Correct, Noise-Reducing Mic, Zoom, Microsoft, Teams, Skype, Nintendo Switch 2 New GameChat Mode, PC Mac compatible
  • 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.

The profile path is interpreted where Chrome runs. With Remote WebDriver or Grid, a path on the Python client is not automatically available on the browser host or container. Confirm that the browser runtime can access the intended profile and that the output path is writable in the process saving the image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

  • The page is logged out: Check that the argument points to the intended directory and that it contains the profile state you expect. Look for a login redirect, confirm the session remains valid, and wait for an authenticated-only element.
  • Chrome will not start or reports the profile is in use: Close other Chrome processes using that profile, or assign separate profile directories to concurrent jobs.
  • The screenshot file is missing: Create the parent directory, use a full writable path ending in .png, and check the boolean returned by save_screenshot().
  • The image omits page content: The documented method captures the current window. Adjust the viewport for a larger window capture or use a separately verified full-page technique.
  • Driver startup fails: Check Chrome and ChromeDriver major versions and verify how the browser binaries are installed in that environment.
  • The wait for the login marker times out: Confirm the selector matches the signed-in page, inspect whether the page redirected, and account for the possibility that authentication expired or additional verification is required.

Or skip the browser setup

ScreenshotNeo can return a screenshot or PDF with one GET request. Its cookie/consent handling accepts the banner like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses indicate the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents.

For example, save a page as WebP with cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/account -o shot.webp

See the ScreenshotNeo API documentation for request options. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Does Selenium’s user data directory automatically log me in?

No. It selects Chrome profile state; the website still decides whether the session is valid.

Does save_screenshot() capture the whole page?

No. The documented Python method captures the current window.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.