How to Capture Landing Page Screenshots Across Countries with Playwright

Scrapeless Agent Browser runs Playwright-controlled page captures remotely, and Scrapeless Residential Proxies provide geographic routing for teams that run their own browser.

TL;DR

  • A regional screenshot needs an observed exit country. Record the requested route separately from the result of your network check.
  • Each country should get a fresh browser context for first-visit captures. Keep locale, viewport, and consent state explicit.
  • A capture should wait for the campaign's content. Use a stable heading or offer element as the readiness signal.
  • A usable screenshot needs supporting metadata. Include the final URL, expected market marker, and evidence of the browser settings.

Build a Country and Capture Matrix

A Playwright capture matrix describes the network and browser conditions behind every image. Start with the campaign URL, requested market, expected destination, and visible market markers. Good markers include a localized offer heading, displayed currency, or a region-specific primary button. A single word like “Continue” is weak evidence when the same label appears in several storefronts.

Suppose a launch has a German landing page and a Canadian landing page. An illustrative matrix might group the German journey by its expected German-language heading and its EUR price, and the Canadian journey by its expected locale and CAD price. If Canada supports different language experiences, create separate rows for each supported locale. Store the UTC capture time and target device profile so a reviewer can identify why two captures differ. The Unicode locale and currency formatting rules help explain why two displays of the same price can differ even when the underlying amount is unchanged.

InputCapture decisionEvidence
CountryRun an independent network observation for each marketRequested country and observed exit country
LocaleMatch the expected language or test it as a controlled variableConfigured locale and visible heading
Device profileUse a consistent viewport and scale for each device classScreen dimensions and screenshot
ConsentChoose first visit, accepted, or rejectedObserved banner state and action
Page stateWait for the offer or other durable markerFinal URL, marker result, image path

Install Playwright and Choose the Browser Runtime

Playwright can control a local Chromium browser or connect to a provisioned Chromium session through CDP. Use the Playwright proxy configuration guide when the runner owns the browser process and needs per-market proxy settings. Use the Scrapeless Agent Browser product when you want the browser itself to run remotely. The Agent Browser Playwright quickstart documents how to authenticate and connect. Keep the complete connection URL or the standalone proxy credentials in your runner's secret store.

Create one region-specific session before navigation. With a self-managed browser, use the Scrapeless residential proxy product and configure the chosen region on its proxy credentials. With Agent Browser, use the settings documented for Agent Browser network routing. Verify the route from the browser or through the same configured proxy before visiting the campaign. A check from the controller's machine would report the controller's network context, which can differ from the browser's.

Install the Playwright package and a supported browser for local execution. The capture script also needs the campaign's approved URL and a known heading or other durable locator for that market. When operating remotely, ensure the session endpoint is provisioned and that your test destination is reachable from the selected browser environment. A private staging host needs its own approved network access setup.

Wait for the Page State You Want to Photograph

A ready screenshot captures the expected marketing state after the relevant JavaScript has rendered. Early navigation milestones indicate that the page is progressing. They are poor substitutes for an offer assertion when a hero image or price is hydrated separately. Wait for the heading or offer card, check the displayed currency if it matters, and decide whether a banner is expected in this row. Use an element screenshot for the offer itself and a viewport capture when the question concerns the fold, sticky controls, or overlapping banners.

Playwright documents viewport, full-page, and element screenshots. Capture the viewport first when reviewing the first impression. A full-page image can include lazy-loaded regions or shift what appears while content loads, so define a separate scroll and readiness rule for below-the-fold evidence. The media query standard explains how layout can vary with viewport and device characteristics. Use matching screen size, scale, color mode, and browser configuration when the screenshots are meant for comparison.

If the test describes an existing layout bug, preserve it in the image. Waiting for the expected heading has a finite deadline. On expiration, save the observed destination and, if the visible page is safe to capture, record the rendered state as incomplete. That produces useful failure evidence when a deployment swaps the headline, introduces an error template, or suppresses the CTA for a particular locale.

Capture an Approved Page and Save Its Metadata

A minimal Playwright capture can assert a page heading and retain the actual final URL and screenshot. The example accepts a preconfigured remote session or a local Chromium installation. Regional routing is a prerequisite for the remote path and must be verified separately. The local form is useful for exercising the capture logic against an owned test page before adding regional routes.

import { chromium } from 'playwright'
import { writeFile } from 'node:fs/promises'
const { TARGET_URL, EXPECTED_HEADING, BROWSER_CDP_URL } = process.env
if (!TARGET_URL || !EXPECTED_HEADING) throw new Error('Set target and heading')
const browser = BROWSER_CDP_URL
  ? await chromium.connectOverCDP(BROWSER_CDP_URL)
  : await chromium.launch()
try {
  const context = await browser.newContext({
    viewport: { width: 1280, height: 800 },
    deviceScaleFactor: 1,
    locale: process.env.CAPTURE_LOCALE || 'en-US',
  })
  const page = await context.newPage()
  const response = await page.goto(TARGET_URL, {
    waitUntil: 'domcontentloaded',
  })
  if (!response?.ok()) throw new Error('Unexpected document response')
  await page.getByRole('heading', {
    name: EXPECTED_HEADING, exact: true,
  }).waitFor({ state: 'visible' })
  await page.screenshot({ path: 'landing.png', animations: 'disabled' })
  await writeFile('landing.json', JSON.stringify({
    finalUrl: page.url(),
    status: response.status(),
    heading: EXPECTED_HEADING,
    viewport: page.viewportSize(),
    capturedAt: new Date().toISOString(),
  }, null, 2))
} finally {
  await browser.close()
}

Run each market in its own artifact directory so a later capture cannot overwrite a previous one. The browser's recorded final URL is useful for navigating back to the destination and comparing it with the requested path. For campaigns containing unique click identifiers, store only approved fields and a redacted URL in shared artifacts. Keep the full request chain separately if the operator needs it to diagnose a redirect.

Diagnose Unexpected Regional Screenshots

A mismatch is easier to diagnose when the screenshot and metadata can isolate a single variable. If the observed exit is wrong, inspect the route first. If the exit matches but the language is unexpected, compare the configured locale, the page's local path, and any cookie left by another capture. If the title is correct but an offer card is blank, check the request that supplies the offer and confirm that the page rendered the expected state before taking the image.

A temporary sale can end in one market before another when its public terms use different time zones. Compare only captures made within the intended campaign window. If policy blocks an automated request, record the access state and use an authorized preview or manually approved comparison. If another discrepancy remains, save the scenario as inconclusive until the initiating conditions and the intended route are clear.

Send a Reviewable Capture to the Campaign Owner

A good review packet lets a campaign owner see the deviation and understand how it was observed. Put the campaign name and market in the subject, then attach the screenshot, expected marker, observed marker, and sanitized final URL. For a layout defect specify the viewport and visible overlap. For a country mismatch explain whether the network exit was verified. Keep the measured distinction between requested and observed routing visible in the report.

The regional landing-page verification workflow gives teams a way to organize the market checks before expanding them. If Playwright runs across many campaigns, track the number of complete, usable captures for each environment. Compare those outcomes and browser and proxy usage against the team's storage and review requirements.

Conclusion

Start with one approved URL, a known local offer marker, and two expected regional outcomes. Capture the same browser state from each verified route and include the final destination beside each image. Move execution into the managed browser automation workflow when the team needs to run the same capture process beyond a local workstation.

Ready to Capture Campaign Pages Across Markets?

Set up a Playwright capture with Agent Browser or route your own Chromium runner through Scrapeless Proxies.

Sign up today and get $5 in free credit — no credit card required.

Claim Your $5 Credit →

FAQ

Can changing Playwright's locale change the source IP?

Playwright's locale setting changes browser language-related behavior. The source IP depends on the configured network route.

Can one Playwright context capture every country?

Use a fresh context and the selected network route for each first-visit scenario. Keep one context within a single journey when earlier navigation or consent state must carry over.

Is a full-page screenshot necessary?

A viewport image works well for above-the-fold QA. A full-page screenshot serves a different review task, so define what below-the-fold elements must be ready before capture.

What if the available locator changes?

Check the version of the campaign and inspect the approved page state. Prefer a stable heading, accessible name, or a test identifier provided by the site owner.

How many captures should run at the same time?

Start with a small number of workers per host and follow the approved rate budget. Add concurrency only after the target owner and your own infrastructure can support it.

Can the capture run without an AI agent?

Yes. Playwright can execute browser navigation, wait for a page element, and write evidence directly from a scheduled script.

References