Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon 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 Now×
Skip to content
World desk7 min

How to Capture a Web Page Behind a Login Using Selenium for a Report

A practical Selenium workflow for capturing an authorized logged-in report, choosing PNG or PDF, verifying the output, and troubleshooting common failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a page you’re authorized to access, use Selenium WebDriver to complete the site’s normal login flow, navigate to the report, wait for a page-specific sign that its authenticated content is ready, then save a screenshot or PDF. A successful page load alone does not prove that a JavaScript-rendered report is ready.

Before you start: access, tools, and credentials

Selenium WebDriver automates a browser through the WebDriver interface. Use an account explicitly authorized to view the page and include its content in your report. Login flows vary: a site may use a form, single sign-on (SSO), multi-factor authentication (MFA), or other controls. Follow the site’s supported flow; Selenium is not a method for bypassing access controls.

As an Amazon Associate I earn from qualifying purchases.

  • Install Selenium and a compatible browser and driver, or use a Selenium setup that manages the browser components for you. Keep the versions available for your later report notes.
  • Use a low-privilege account that has only the access needed for the task. Do not store credentials in source code or include passwords, cookies, or authentication tokens in logs or report files.
  • Run browser automation in a protected environment, such as a container or virtual machine. Google’s ChromeDriver security guidance says not to run ChromeDriver as a privileged account and recommends protecting the environment and its network access.
  • Identify the page’s actual login controls and a reliable marker of the report view, such as its title or data table. Selectors are site-specific; the example below uses placeholders that you must replace.

Log in, verify the report, and save a screenshot

This Python example uses a normal username-and-password form. It waits for a report-specific element instead of assuming that navigation finishing means the report is ready. Replace the URL, selectors, and environment variable names with values appropriate for the site. Install Selenium with python -m pip install selenium; set REPORT_USERNAME and REPORT_PASSWORD in your environment before running it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import os
from pathlib import Path
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

login_url = "https://example.com/login"
report_url = "https://example.com/reports/monthly"
output_path = Path("report.png")

username = os.environ["REPORT_USERNAME"]
password = os.environ["REPORT_PASSWORD"]

options = webdriver.ChromeOptions()
# For a visible browser, leave headless mode off. See the PDF section below
# before enabling headless mode for print-to-PDF workflows.

driver = webdriver.Chrome(options=options)
try:
    wait = WebDriverWait(driver, 30)
    driver.get(login_url)

    wait.until(EC.visibility_of_element_located((By.NAME, "username"))).send_keys(username)
    driver.find_element(By.NAME, "password").send_keys(password)
    driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()

    # If the site requires an approved SSO or MFA step, complete it through
    # the site's normal flow before continuing. Do not attempt to bypass it.
    wait.until(EC.url_contains("/dashboard"))

    driver.get(report_url)
    wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "h1.report-title")))
    wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "table.report-data")))

    output_path.parent.mkdir(parents=True, exist_ok=True)
    if not driver.save_screenshot(str(output_path)):
        raise RuntimeError(f"Could not save screenshot to {output_path}")
finally:
    driver.quit()

The example’s selectors and dashboard URL are illustrative, not universal. Some sites redirect after login, render the report differently, or require a user-approved SSO or MFA interaction. Adapt the success condition to a stable element that demonstrates you reached the intended authenticated report, not merely any post-login page.

#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

Why an explicit wait matters

Selenium’s navigation waits for a document readyState according to the page-load strategy, but page scripts may still populate or change report content afterward. Selenium’s waiting strategies documentation explains that explicit waits poll a specified condition until it becomes true or times out. Wait for evidence that matters to your page: for example, the report heading and data table appearing, or a loading indicator disappearing.

Use explicit waits for those conditions rather than relying on a fixed sleep, which may be too short on a slow response and waste time on a fast one. Do not mix implicit and explicit waits; Selenium warns that doing so can produce unpredictable wait times. The page-load strategy can be normal, eager, or none, but changing it does not establish that a single-page application’s later JavaScript work is complete. Keep the default unless you have a demonstrated reason to change it, and retain a meaningful explicit wait.

Rank #2
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.

Choose a screenshot or PDF

Need Better fit Consider
Show the report as it appeared in the browser viewport Screenshot The Python API’s save_screenshot() saves a PNG of the current browser window. Check the selected browser and API if you need full-page capture; support differs.
Attach a paginated, print-friendly document PDF Print output can differ from the visible page. Check pagination, margins, backgrounds, and legibility before using it.

Save a PDF with Selenium

Selenium’s Print Page capability generates a PDF of the current page, with settings for orientation, page ranges, paper size, margins, scale, background rendering, and shrink-to-fit. Selenium’s windows and tabs documentation notes that Chromium print-page support requires headless mode. Add headless mode to the Chrome options in the earlier example, then, after the report-specific waits, print and save the returned PDF data:

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

options.add_argument("--headless=new")
# Use these lines in the earlier example after the report has loaded.
pdf_data = driver.print_page()
Path("report.pdf").write_bytes(base64.b64decode(pdf_data))

Keep the browser configuration and PDF workflow consistent with the Selenium and browser versions you record. Print behavior and page layout can vary, so inspect the resulting file rather than assuming it matches the live viewport.

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.

Check the artifact and record report context

Before attaching the capture to a report, open it and confirm it shows the intended authenticated page rather than a login form, error, or empty loading shell. A rendered capture shows what the browser displayed; it does not independently establish that the underlying report data is accurate.

Record enough context for another reader to interpret the artifact:

Rank #4
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)
  • Exact page URL and capture timestamp in UTC.
  • Report date range and filters visible or applied at capture time.
  • Browser and Selenium versions, output type, and whether the browser ran headlessly.
  • Account context only if appropriate and permitted for the report.

Do not include passwords, session cookies, authentication tokens, or personal information that is not needed. These notes help explain the capture but do not, by themselves, establish compliance with a legal or regulated chain-of-custody standard.

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

Troubleshoot common failures

Symptom Likely cause What to do
Browser or driver fails to start Browser and driver components are incompatible, unavailable, or blocked by the execution environment. Install compatible components, check the error output, and verify the browser can run in the protected environment. Keep browser and driver versions noted.
Login field or submit button is not found The example selector does not match the site, the form has not rendered, or the login is presented in a different flow. Inspect the page you are authorized to access and update the selectors. Wait for the actual field or control; do not assume every site uses the same form.
Login wait times out The site redirects differently, needs an SSO or MFA step, rejected the account, or the success condition is wrong. Check the visible browser state and follow the site’s supported authentication flow. Replace the illustrative URL condition with a real success marker. Do not try to defeat a challenge or access policy.
Screenshot shows a loading shell or incomplete report Document loading finished before client-side report data appeared, or the chosen condition is too weak. Wait for a report-specific heading, table, or other stable marker; if appropriate, also wait for the loading indicator to disappear. Verify the saved artifact.
PDF printing fails in Chromium Print-page support requires headless mode in Selenium’s documented Chromium workflow. Enable headless mode and use the print-page API after the report is ready. Check that the output is a valid PDF and test its layout.
Wait duration is erratic Implicit and explicit waits may be mixed, or the condition does not represent readiness. Use a focused explicit wait for the intended content and avoid mixing wait types.

Or skip the browser setup

If your task is simply to capture a publicly reachable page, ScreenshotNeo can return an image or PDF with one GET request. It is a website screenshot API and MCP server for developers; it does not replace an authorized login flow for a private page.

Install the Python dependency with python -m pip install requests, set your API key securely, then run:

import requests

r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

See the ScreenshotNeo documentation for request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000. Sign up free for 1,000 screenshots a month, with no card.

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.

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

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
Windows Errors? Fix Them Before They SpreadFree repair scan

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.