DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

How to Capture a Screenshot of a Page Behind HTTP Basic Authentication

Set HTTP Basic Auth credentials on a Playwright browser context before navigation, verify the protected page has loaded, and save the screenshot.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For an HTTP Basic Auth prompt, give the authorized username and password to the browser context before opening the page, then save a screenshot after confirming the protected content has loaded. In Playwright, use httpCredentials and page.screenshot(). A website’s own login form is different: it needs that site’s supported sign-in flow, not Basic Auth credentials.

First identify which kind of login the page uses

HTTP Basic Authentication is an HTTP-level challenge: the browser or request client supplies credentials when the server asks for them. An application login is a form rendered by the website, often followed by a redirect or a session cookie. Supplying httpCredentials does not fill in that form or establish an application session.

As an Amazon Associate I earn from qualifying purchases.

Before automating access, make sure you are authorized both to open the protected URL and to capture its contents. If the browser shows a username-and-password dialog before the page renders, Basic Auth may be in use; if the page itself contains a sign-in form, use the site’s documented application-login method instead.

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

Capture a Basic Auth page with Playwright

Playwright’s browser context accepts HTTP credentials before navigation. That avoids trying to locate or type into the browser’s native authentication dialog. The example below uses Node.js and environment variables for credentials and the protected URL.

#1 Best Overall
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
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const context = await browser.newContext({
      httpCredentials: {
        username: process.env.BASIC_AUTH_USERNAME,
        password: process.env.BASIC_AUTH_PASSWORD,
      },
    });
    const page = await context.newPage();
    await page.goto(process.env.PROTECTED_URL);

    // Replace this with a selector or assertion specific to the expected page.
    await page.locator('main').waitFor({ state: 'visible' });
    await page.screenshot({ path: 'protected-page.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

The credential property names and screenshot options follow Playwright’s documented APIs: HTTP authentication and the Page screenshot API. The main selector is only an example; use a reliable element or text unique to the authorized page. Keep real credentials out of committed scripts and logs.

Set the variables and run it

Install Playwright in the project and its browser binaries, then provide the URL and credentials in your shell or secret manager before running the script. For example, on a POSIX shell:

export PROTECTED_URL='https://example.com/private/'
export BASIC_AUTH_USERNAME='your-authorized-username'
export BASIC_AUTH_PASSWORD='your-authorized-password'
node capture.js

Replace the example URL and credentials with values you are authorized to use. A successful navigation alone does not prove authentication worked: a site can return an error page or redirect. The page-specific readiness check and a review of the resulting image help catch that.

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

Choose the screenshot scope and format

fullPage: true captures the full scrollable page; omit it or set it to false to capture the current viewport. Playwright also supports screenshot output paths, image type selection, and scale options. Choose the format and scale based on whether you need a compact image, crisp detail, or a particular downstream file type, and check the saved image for the intended content.

Or skip the browser setup

ScreenshotNeo accepts a URL in one GET request and can return a screenshot or PDF. Its API supports custom headers, cookies, and Authorization for authenticated capture; use only an authentication method appropriate to your protected page. For HTTP Basic Auth, supply the authorization header as a secret rather than putting credentials in a public URL.

Example API request, with a protected target URL:

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

See the ScreenshotNeo API documentation for request parameters and authentication 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 a month with no card, and paid plans start at $5 for 3,000. Sign up for free screenshots.

Other hosted capture options

Cloudflare Browser Run documents a screenshot endpoint with an authenticate object containing a username and password for Basic Auth. It also documents session cookies, custom authorization headers, viewport controls, full-page capture, and readiness settings. For JavaScript-heavy pages, its documentation describes waiting for network idle or a specific selector because the initial page-load event may occur before client-side rendering finishes. Check its current endpoint documentation for the request format and availability applicable to your account: Cloudflare Browser Run.

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

Capture documents an httpAuth parameter that encodes username:password as base64url for its API. That parameter format is specific to Capture and should not be copied into Playwright or Cloudflare requests. Encoding is not encryption; treat any credential-bearing request data and logs as sensitive. See Capture authentication and headers.

Troubleshooting failed or misleading captures

The prompt remains, or the screenshot shows an error

Check that the server really uses HTTP Basic Auth, the username and password are correct, and the account is authorized for that resource. If navigation reaches an HTML sign-in page or application login route, switch to that site’s supported login flow rather than sending Basic Auth credentials.

The screenshot is blank or incomplete

Wait for a page-specific selector or text instead of relying only on navigation completion. Dynamic pages may continue rendering after the initial load event. In Cloudflare Browser Run, the documented readiness choices include network-idle modes and selector-based waiting; use a condition suited to the page rather than an arbitrary short delay.

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

Content is cut off

Use Playwright’s fullPage: true when you need the entire scrollable page, or configure the hosted endpoint’s full-page option. If the target uses lazy-loaded images, confirm they have loaded before capture; a full-page setting by itself does not establish that every dynamic element is ready.

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

Credentials leak into logs or URLs

Do not hard-code secrets in shared scripts, publish them in examples, or log authorization values. Some API-specific authentication formats place encoded credentials in request parameters; those values remain sensitive. Use the service’s documented secret-handling method and restrict access to logs and stored requests.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing local automation or a hosted API

Use local Playwright when you need direct control over the browser context, credentials, and runtime. A hosted capture endpoint may reduce browser setup, but it must be able to reach the protected host and support the authentication method and readiness behavior the page needs. Compare those operational requirements, capture controls, and costs for your own workload; the cited documentation does not establish a performance benchmark or a like-for-like price comparison.

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.

Frequently Asked Questions

Does HTTP Basic Auth mean I am logged into the website?

It means the server accepted an HTTP authentication challenge; it does not necessarily create the same application session or permissions as the site’s own login flow.

Can I take the screenshot without saving it to a file?

Playwright’s screenshot API can return image data instead of writing to a path; consult the Page API for the return value and supported options.

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.

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 *

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.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.