October 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Schedule Screenshots of Pages Behind HTTP Basic Authentication

Configure HTTP Basic Authentication on a Playwright browser context, capture the page, and let a CI or system scheduler run the job. Learn how to handle login forms, protect credentials, and troubleshoot recurring captures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a scheduled browser-automation job: configure HTTP Basic Authentication credentials on the browser context, open the protected page, wait for the content you need, and save a screenshot. Playwright supports this flow; a CI or system scheduler triggers it separately. A page with its own HTML login form needs a different authentication flow.

Identify the page’s authentication type

HTTP Basic Authentication

Basic Authentication is an HTTP challenge, not a form inside the website. Configure the username and password as httpCredentials on Playwright’s browser context before navigating. Where appropriate, restrict those credentials to the intended origin. See Playwright browser-type documentation.

As an Amazon Associate I earn from qualifying purchases.

A website login form

If the page displays username and password fields, use the application’s login steps instead. Playwright documents browser authentication state as a separate approach; saved state can preserve the authenticated session. See Playwright authentication guidance.

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

Run a scheduled Playwright capture

The following Node.js script uses HTTP Basic Authentication and saves a full-page PNG. It expects Node.js, Playwright, the browser binaries, and credentials in environment variables. Install Playwright in the project and install its browser before running the script:

#1 Best Overall
King&Charles Versatile Screen Roller Tool, 3pcs Different Roller+Hook+Trim
  • --- 𝐏𝐀𝐓𝐄𝐍𝐓 𝐀𝐏𝐏𝐋𝐈𝐄𝐃 𝐅𝐎𝐑---
  • 🏡【𝐊𝐢𝐧𝐠&𝐂𝐡𝐚𝐫𝐥𝐞𝐬 𝐑&𝐃 𝐈𝐧𝐭𝐞𝐧𝐭𝐢𝐨𝐧】Versatile Screen Tool - combines the core functions of multi-size roller, hidden hooks, and replaceable blades, and designed this multifunctional screen tool. It solves the problems of traditional screen installation tools with single functions, lack of safety and adaptability. It truly realizes multiple uses of one tool, making screen replacement time-saving, labor-saving, and worry-free. One-time purchase can meet your installation or replacement needs.
  • 🏡【𝟑 𝐒𝐢𝐳𝐞𝐬 𝐈𝐧𝐭𝐞𝐫𝐜𝐡𝐚𝐧𝐠𝐞𝐚𝐛𝐥𝐞 𝐑𝐨𝐥𝐥𝐞𝐫𝐬】Flexible Adaptation - In view of the differences in thickness of different window splines, we gift the roller into three specifications: Convex 0.13", Concave 0.13", and Concave 0.18", ensuring perfect matching with the mainstream rubber strip sizes on the market. Feature①: The roller is made of high-hardness plastic, which is strong and durable while avoiding the risk of traditional metal rollers scratching the screen mesh. Feature②: Metal bearing design - smoother rotation, even pressure without deviation. TIPS: you can use the provided Allen wrench to quickly disassemble and replace them.
  • 🏡【𝐁𝐥𝐚𝐝𝐞 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧-𝐑𝐞𝐭𝐫𝐚𝐜𝐭𝐚𝐛𝐥𝐞&𝐒𝐭𝐨𝐫𝐚𝐠𝐞&𝐑𝐞𝐩𝐥𝐚𝐜𝐞𝐚𝐛𝐥𝐞】①Retractable-When in use, just hold button, blade will slow rollout, convenient trimming and cutting. Blade can be retracted to prevent Accident scratches. ②Blade has double locking device: it automatically locks to prevent retraction during work and is completely closed to prevent accidental touch when retracted. Ansure your safety. ③Replaceable - A separate button is provided for changing the blades. ④Blade is made of steel-sharp, durable and won't rust. ⑤Storage-Handle has built-in blade storage design to place complimentary blade.Extra equipped 2xreplacement blades- increase service life of tool.
  • 🏡【𝐇𝐢𝐝𝐞𝐚𝐛𝐥𝐞 𝐑𝐞𝐦𝐨𝐯𝐚𝐥 𝐇𝐨𝐨𝐤】The hooks are sharp and can hook out the aged spline. The removal hook can be stored and hidden in the handle slot box. OPEN the box cover, take out the hook and insert it into the groove for use. can RETRACT after use to prevent the hook tip from scratching clothes or tool boxes. Hook made of Stainless steel material won't rust.
npm install playwright
npx playwright install chromium

Save as capture.js:

const { chromium } = require('playwright');

async function main() {
  const targetUrl = process.env.TARGET_URL;
  const username = process.env.BASIC_AUTH_USERNAME;
  const password = process.env.BASIC_AUTH_PASSWORD;

  if (!targetUrl || !username || !password) {
    throw new Error('Set TARGET_URL, BASIC_AUTH_USERNAME, and BASIC_AUTH_PASSWORD.');
  }

  const browser = await chromium.launch({ headless: true });
  try {
    const context = await browser.newContext({
      httpCredentials: { username, password },
    });
    const page = await context.newPage();
    await page.goto(targetUrl, { waitUntil: 'load' });

    // Replace with a selector that indicates the page is ready, if needed.
    await page.screenshot({ path: 'capture.png', fullPage: true });
    await context.close();
  } finally {
    await browser.close();
  }
}

main().catch((error) => {
  console.error(error.message);
  process.exitCode = 1;
});

Provide the three environment variables through your runner’s secret mechanism, rather than putting real credentials in the script or command history. If the site uses a non-default port or subpath, verify the target URL and credential scope; Playwright supports an origin value to limit where HTTP credentials are sent. Consult the browser context API for the current context options.

Choose what “ready” means

waitUntil: 'load' waits for the page load event, but a site may render important content afterward. For repeatable captures, wait for a site-specific selector or other condition that signals the content is ready. There is no universal readiness selector: choose one from the page being captured.

Choose viewport or full-page output

Use fullPage: true to capture the full scrollable document, as in the example. Omit it or set it to false for the current viewport. Playwright’s screenshot API also supports choosing an output path and other capture options; see page screenshot options.

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

Attach a scheduler

The scheduler starts the script; it does not handle authentication or screenshot capture. Use the scheduler already supported by your environment, and check its current documentation for exact syntax because scheduling configuration varies by provider.

Choice Consider it when Check before relying on it
CI workflow scheduler Your project already runs automation in CI and its runner can reach the protected page. Browser installation, secret access, job history and alerts, network access, and where artifacts are retained.
System scheduler on a maintained host You control a machine with the script and browser installed, especially if the target is only reachable on a private network. Host maintenance, schedule monitoring, secret storage, network access, and screenshot cleanup or retention.

Playwright documents running browser jobs in CI, but scheduler syntax and guarantees belong to the CI provider. See Playwright’s CI guide.

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

Protect credentials and screenshots

  • Store the Basic Authentication username and password in the runner’s secret store, and do not print them in logs.
  • Do not commit passwords or authenticated browser-state files. Playwright warns that saved state can contain cookies and headers that allow account impersonation and says, “We strongly discourage checking them into private or public repositories.” Keep authentication-state directories in .gitignore.
  • Restrict access to the screenshot output: protected pages can contain sensitive information. Decide which job artifacts or storage locations may retain images and for how long.

See Playwright’s authentication guidance for state-file handling.

Make recurring screenshots comparable

Keep the browser environment consistent across runs when visual changes matter. Playwright notes that rendering can differ with operating system, browser version, settings, hardware, power source, and headless mode. Pin or otherwise keep those conditions stable where practical, and interpret differences alongside the environment used for each capture. See Playwright snapshot guidance.

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

Troubleshoot failed captures

  • The page keeps prompting for credentials or shows an access error: confirm the page uses HTTP Basic Authentication rather than an HTML login form, check the username and password, and verify the URL and credential origin.
  • The screenshot is blank or misses content: confirm navigation reached the intended page, then wait for a page-specific element or readiness condition before taking the screenshot.
  • The image cuts off the page: check that fullPage: true is set; viewport screenshots capture only the visible area.
  • The job works locally but not in CI: verify that the runner installed the browser dependencies, can reach the protected host, and receives its secrets. Check the CI provider’s job logs and current Playwright CI guidance.
  • Recurring images differ unexpectedly: compare browser version, operating system, settings, hardware, and headless mode between runs before treating the difference as a site change.

Or skip the browser setup

If an API fits your workflow, ScreenshotNeo accepts one GET request with a URL and can return an image or PDF. It removes supported cookie-consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status. Its MCP server provides screenshot tools for AI agents. The service supports custom headers, cookies, and Authorization, but the available product facts do not establish a dedicated HTTP Basic Authentication parameter; verify that your target’s authentication method works with the supported request options before relying on it for a protected page.

One-call example using the documented API pattern (replace the URL with your target; add credentials only using a supported authentication method):

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

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

Quick Recap

Bestseller No. 1
King&Charles Versatile Screen Roller Tool, 3pcs Different Roller+Hook+Trim
King&Charles Versatile Screen Roller Tool, 3pcs Different Roller+Hook+Trim
--- 𝐏𝐀𝐓𝐄𝐍𝐓 𝐀𝐏𝐏𝐋𝐈𝐄𝐃 𝐅𝐎𝐑---
$12.99

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.

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.

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
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.