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, navigate to the page, verify that the authenticated view has loaded, and save a PNG. The profile can provide browser state, but it does not guarantee that the site’s session is still valid.

Use a dedicated Chrome profile and verify login before capturing

This Python example opens Chrome with a selected user data directory, waits for a site-specific element that appears only when logged in, and saves a current-window PNG. Replace the example URL, paths, and selector with values for your site.

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 an element unique to the authenticated page.
    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()

The selector is illustrative, not a universal locator. Choose a stable element that is present only in the intended logged-in view, such as an account navigation item or page heading. If the wait times out, the script raises an exception instead of silently saving a login screen.

Set up the profile and authentication

  1. Choose a writable directory. Pass an absolute path to --user-data-dir. Chrome uses that directory for profile state; Selenium’s Chrome documentation lists this argument among the browser arguments you can set (Selenium Chrome-specific functionality).
  2. Prepare the profile deliberately. Sign in through an allowed flow using that profile, or configure authentication using an approved test account and site-specific process. A directory containing profile data is not proof that the site will accept its session.
  3. Keep concurrent runs separate. Avoid starting multiple Chrome instances with the same profile directory. For parallel jobs, assign each run its own directory; profile sharing can prevent a run from starting or make state unpredictable.
  4. Run the script where Chrome can access the path. With remote WebDriver or Grid, the path must be available to the machine or container running Chrome, not merely to the Python client. The details depend on your deployment.

Selenium’s JavaScript Chrome driver documentation says a new session has a clean user profile unless configured through Options (Selenium JavaScript Chrome driver API). Selecting a directory supplies profile state; it does not override session expiry, server-side revocation, account security checks, or site-specific login requirements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • 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

Wait for the authenticated page, not just navigation

driver.get() navigates to the URL, but a page-load event alone does not establish that the application is logged in or that client-rendered content is ready. The example uses WebDriverWait to wait for a locator that is unique to the authenticated view. Choose the timeout for the site and environment, and handle login redirects explicitly if your workflow needs a clearer error.

Do not use a generic element such as a logo or page container as proof of authentication if it also appears on the sign-in page. A login-only redirect or missing account element should cause the run to fail rather than produce a misleading screenshot.

Rank #2
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera
  • 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)

Save the right screenshot

save_screenshot() saves the current window as a PNG and returns a boolean success indicator. Selenium’s Python WebDriver API documents this behavior (Selenium Python WebDriver API). The example creates the destination folder first and checks the return value.

This is a current-window capture, not a documented full-document screenshot. If the viewport omits content, set an appropriate browser window size before capture. For a full-page image, use a separately verified method for your browser and Selenium setup rather than assuming this API captures beyond the current window.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

When cookies may be a better fit

Selenium can also inspect or add cookies. Its guide notes that cookies are mostly used to recognize users and load stored information, and that you must first navigate to a domain where a cookie is valid before adding it (Selenium: Working with cookies).

Cookies can be useful when a test explicitly manages a session cookie, but they may not include all the state a site requires for login. A Chrome profile directory is a broader way to select browser profile state; neither method guarantees that the target service will accept an expired or otherwise invalid session.

Rank #4
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • 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.

Compatibility and environment checks

Selenium’s Chrome documentation states that Selenium 4 is compatible with Chrome v75 and greater and that Chrome and ChromeDriver major versions should match. The page’s version guidance was last modified July 17, 2026; treat it as the documentation’s compatibility guidance, not a guarantee for every managed browser, container, or Grid deployment. Check the browser and driver actually used by your run.

Troubleshoot common failures

  • The page looks logged out: Confirm the exact profile path passed to Chrome and that it contains the intended profile state. Check whether navigation redirected to sign-in, whether the session expired, and whether the authenticated-only selector is correct.
  • Chrome will not start or says the profile is in use: Close processes using that directory and give parallel runs separate profile directories.
  • The screenshot file is missing: Use a writable absolute output path, create its parent directory, retain the .png suffix, 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 choose a separately verified full-page technique if the whole document is required.
  • Driver startup fails: Check that Chrome and ChromeDriver major versions match and that the runtime has access to the browser and driver binaries.
  • The script times out waiting for login: Confirm that the locator exists only on the authenticated page, inspect whether the site rendered a login or security-check screen, and tune the wait for the application’s actual load behavior.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a one-request screenshot, ScreenshotNeo accepts a URL and returns an image or PDF. Its cleanup can accept cookie or consent banners and remove 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses include X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.

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

To capture a URL, use your ScreenshotNeo access key and the API endpoint. See the ScreenshotNeo documentation for request options.

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

The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for the free plan.

Frequently Asked Questions

Can Selenium reuse the profile from my regular Chrome installation?

It can be configured with a user data directory, but a dedicated automation profile is usually safer than sharing a profile that another Chrome process may be using.

Does a saved profile guarantee that I will still be logged in?

No. The site can expire or revoke a session or require additional checks; verify an authenticated-only page element before capturing.

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

Does Selenium’s save_screenshot method capture a whole long page?

The documented Python method saves the current window as a PNG; it should not be treated as a full-document capture.

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.