Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween 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 Now×
FREEDOM251

Freedom251 › Blog › browser automation

How to Capture a Screenshot of a Canonical URL After Redirects

By Freedom251 Team · · 5 min read

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.

Use a browser to navigate to the starting URL, wait for the page condition you need, then record the final browser address and take the screenshot. In this guide, “canonical URL” means the final address reached by navigation unless stated otherwise. A page’s declared SEO canonical URL is a separate signal; redirects alone do not tell you what the page declares.

Final URL and declared canonical URL are different

A browser follows navigation redirects and ends at a destination URL. That final address answers “where did this visit land?” A page may also declare an SEO canonical URL in a <link rel="canonical"> element. That declaration answers a different question and may not match the address in the browser.

As an Amazon Associate I earn from qualifying purchases.

The method below captures the page reached by navigating to your starting URL. If you need a screenshot of the declared canonical target instead, inspect the declaration separately and navigate to that target explicitly. The Playwright navigation references cover redirects and browser URLs, not SEO canonical selection.

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

Capture the page reached after redirects with Playwright

Install Playwright and its browser for your project using the official installation guide. The following Node.js example navigates to a URL, reports the final browser URL and response status, and saves a full-page PNG.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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 startUrl = 'https://example.com';
  const browser = await chromium.launch();
  const page = await browser.newPage();

  try {
    const response = await page.goto(startUrl, { waitUntil: 'domcontentloaded' });
    const finalUrl = page.url();
    const status = response?.status() ?? null;

    console.log({ startUrl, finalUrl, status });

    if (status !== null && status >= 400) {
      throw new Error(`Navigation reached an HTTP error response: ${status}`);
    }

    await page.screenshot({ path: 'page.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

Use a fully qualified starting URL, including https:// or http://. page.goto() returns the main-resource response for the first non-redirect response in the chain, and page.url() gives the address of the page currently loaded. The status check matters: navigation can complete even when the server returns an HTTP error such as 404 or 500. Playwright documents that valid HTTP response statuses do not, by themselves, cause goto() to throw.

Choose when the page is ready

The example waits for domcontentloaded, which is a practical starting point but not a guarantee that every application has finished rendering its important content. For a page with client-side rendering or delayed data, wait for a condition tied to that page, such as a selector that appears when the relevant content is ready:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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
await page.goto(startUrl, { waitUntil: 'domcontentloaded' });
await page.locator('main article').waitFor({ state: 'visible' });
await page.screenshot({ path: 'page.png', fullPage: true });

Replace the selector with one that identifies the content you need. The Page API marks networkidle as discouraged for testing; it should not be treated as a universal signal that an application is ready.

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

Capture the viewport or the full page

fullPage: true captures the full scrollable page. Omit it to capture only the current viewport. Pick based on whether you need a complete page record or a view matching what someone sees without scrolling.

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

Inspect the redirect chain when you need it

The final URL is often enough to identify the destination. To log the server-side request chain, follow the navigation response’s request backward through redirectedFrom():

const response = await page.goto(startUrl, { waitUntil: 'domcontentloaded' });
const chain = [];
let request = response?.request();

while (request) {
  chain.unshift(request.url());
  request = request.redirectedFrom();
}

console.log({ chain, finalUrl: page.url(), status: response?.status() });

Playwright represents redirects with linked request objects. The response’s request is the last request in the chain, and walking redirectedFrom() reaches earlier requests. This is useful for recording the redirect path; it does not establish the document’s SEO canonical declaration.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • 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

Check the page’s declared canonical separately

If by “canonical URL” you mean the page’s SEO declaration, inspect the loaded document’s canonical link after navigation:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const declaredCanonical = await page.locator('link[rel="canonical"]').getAttribute('href');
console.log({ finalUrl: page.url(), declaredCanonical });

The value may be relative, so resolve it against the page URL before comparing or navigating to it:

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.
const absoluteCanonical = declaredCanonical
  ? new URL(declaredCanonical, page.url()).href
  : null;

console.log({ finalUrl: page.url(), absoluteCanonical });

This reads the declaration in the rendered document. It does not prove that a search engine accepts or uses that declaration. If your goal is a screenshot of the declared target rather than the redirect destination, navigate to the resolved canonical URL and capture that page as a separate visit.

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

Make the screenshot reproducible

For a screenshot that must be audited or recreated, save the image alongside the starting URL, final browser URL, capture timestamp, HTTP status, browser/version, and viewport settings. Also record whether the capture was viewport-only or full-page and what readiness condition was used. These details help distinguish a changed page from a changed capture setup.

Troubleshooting

  • The screenshot shows an error page. Check the returned response status; a completed goto() can still correspond to a 404 or 500. Decide whether to keep an error screenshot or treat the capture as failed.
  • The page is blank or missing content. The application may render important content after the initial document event. Wait for a page-specific selector or other application readiness condition before taking the screenshot.
  • Navigation times out, the host is unreachable, or TLS fails. These are navigation failures rather than successful captures. Check that the URL is correct and accessible from the machine running the browser, then handle Playwright’s navigation error or timeout instead of proceeding as if the page loaded.
  • The final URL is unexpected. Log page.url() after navigation and inspect the request chain with redirectedFrom(). Confirm whether the site redirected to a login, locale, consent, or error destination.
  • The declared canonical is missing or unexpected. Inspect link[rel="canonical"] in the loaded document and resolve relative values against the final page URL. Do not infer the declaration from the redirect destination.
  • The screenshot cuts off the page. Use fullPage: true when you need the entire scrollable document; otherwise Playwright captures the viewport.

Or skip the browser setup

ScreenshotNeo can capture a URL with one GET request. For example, this saves a screenshot of the page reached at the requested address:

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo documentation for request options. Cookie banners are accepted and removed before capture, along with known newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server provides screenshot tools for AI agents. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

Sign up free for 1,000 screenshots a month, with no card required.

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.

browser automationPlaywrightredirectsscreenshotsWeb development

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.

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.