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

To capture a webpage as if the browser were at a chosen location, configure geolocation and grant the geolocation permission in the browser context before opening the page. Then wait for the site’s location-dependent interface to update and take the screenshot. Playwright is a practical option for this workflow. The coordinates are a controlled browser input—not proof that a real person or device is physically there.

What browser geolocation changes—and what it does not

Browser geolocation lets an automated page receive chosen coordinates through the browser’s location API. This is useful for authorized testing of location-specific content, such as a store locator or regional page state. It does not change the device’s actual position or establish where a real visitor is located. A site may also use IP-based location, account settings, cookies, locale, or its own location logic, so mocked coordinates do not necessarily determine every regional result.

Use this workflow to test a page or interaction you are authorized to access. A site must request browser geolocation for the mock to affect a feature; setting coordinates alone does not force the page to use them.

Capture a location-specific screenshot with Playwright

Install Playwright and its Chromium browser in your project, then save the following as capture-location.js. The coordinates match an example in Playwright’s documentation; they are sample input, not a claim that the page was tested at that location. See Playwright’s emulation documentation for the documented context settings and Page API for screenshot options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
GlobalSat BU-353N USB GPS Receiver, Black, Made in Taiwan
  • Android supported (app required)
  • Built-In Roof Mount Magnet
  • 75-Channel All-In-View Trackin
  • GPS
  • newer version of BU-353-S4
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const context = await browser.newContext({
      geolocation: { latitude: 41.890221, longitude: 12.492348 },
      permissions: ['geolocation'],
    });
    const page = await context.newPage();
    await page.goto('https://example.com');

    // Replace this with a condition that confirms the target page has
    // finished updating its location-dependent interface.
    await page.screenshot({ path: 'location-view.png', fullPage: true });
    await context.close();
  } finally {
    await browser.close();
  }
})();
  1. Set geolocation and permissions: ['geolocation'] on the browser context before creating or using the page. A context-level setting makes the location available to pages in that context.
  2. Navigate to the page and wait for the specific location-dependent update. Replace the comment in the example with an application-specific condition, such as waiting for a results panel or status message. Navigation finishing does not guarantee that a separate location request or UI update has completed.
  3. Capture the page with page.screenshot(). The example uses fullPage: true to include the full scrollable document; omit it when the viewport alone is the evidence you need.
  4. Close the browser after capture. The try/finally structure ensures the browser is closed even if navigation or capture throws an error.

Change the location after opening the page

If the same test needs a second location, update the context and wait for the page to react before capturing again:

await context.setGeolocation({ latitude: 40.7128, longitude: -74.0060 });
// Wait for the page's location-dependent results to change.
await page.screenshot({ path: 'second-location.png', fullPage: true });

Playwright documents context.setGeolocation() as changing the geolocation for all pages in that context. The application still needs to request or otherwise respond to the location change.

Make the capture reproducible

Geolocation is only one input to a rendered page. For repeatable screenshots, record or set the relevant browser and page conditions as well:

Rank #2
VFAN USB GPS Receiver Antenna Gmouse for Laptop PC Car Marine Navigation Magnetic Base
  • Built-in high-performance UBX-G7020KT multi-GNSS chip supports GPS, GLONASS, QZSS and SBAS, enabling fast and accurate positioning and obtain error-free NTP network time service. With official free GNSS software U-Center, it is easier to parsing the data of GPGGA, GPGLL, GPGSA, GPGSV, GPRMC, GPVTG and GPZD via PC, Laptop.
  • Compatible: Win 11/10/ Win 8/ Win 7/Vista/XP/CE. Free GNSS Evaluation Software. 56-Channel All-IN-VIEW Tracking. Working process: Menu-> Receiver->Port or SensorAPI to get data from GPS Receiver after instialled GNSS software (Software can be downloaded from CD-ROM and Official website)
  • Support OpenCPN, Kali Linux, Realtime Google-Earth Pro and maps. WIth the USB to type c converter, it fits Andriod phone/tablet. ( need to install GPS tools apps, like GNSS Master)
  • With a magnetic base, it is convenient for installation and fixation anywhere., High sensitivity and Strong Singal,Protocol: NMEA 0183, ASCII and TTL stardard. Customizd navigation rate 1-10 hz.
  • Cable Length 6.5 Ft / 2 Meters , IPX4 Water Resistance / Dust-tight. One-year after-sales service. Buy with confidence.
  • Coordinates: use explicit latitude and longitude for the case under test.
  • Viewport and device: keep the browser viewport or device profile consistent; responsive layouts can change the visible result.
  • Browser engine: use the same engine for comparisons, since rendering can differ.
  • Locale and timezone: specify them when dates, language, or regional formatting matter. Playwright’s emulation documentation covers context emulation options.
  • Page state: account for cookies, signed-in state, and any location choices stored by the site.
  • Wait condition and output path: wait for a page-specific signal and use a predictable filename so the captured evidence is identifiable.

Choose viewport or full-page capture

A normal page screenshot captures the visible viewport. Use fullPage: true when the complete scrollable document matters. Full-page images can be larger and may include content that appears only as the browser scrolls, so choose the scope that matches the evidence you need.

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.

Choose an image format for the evidence

Playwright’s page screenshot API supports screenshot output options; check its current API reference for the exact options supported by the installed version. PNG is a lossless choice for crisp interface evidence. JPEG or WebP can be useful when a smaller image payload matters, provided the tool and downstream workflow support the format you choose. Keep the format consistent when comparing captures.

Configure Playwright Test instead of creating the context in code

For a Playwright Test suite, the official emulation documentation shows configuring geolocation and permission under use. For example:

Rank #3
Dual Electronics XGPS160 Multipurpose Universal 5 Device Bluetooth GPS Receiver with Wide Area Augmentation System and Portable Attachment
  • WAAS GPS receiver
  • Simultaneous GPS and GLONASS reception
  • Up to 10 position samples per second
  • Bluetooth connectivity to up to 5 devices
  • Automatic route recording
import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    geolocation: { latitude: 41.890221, longitude: 12.492348 },
    permissions: ['geolocation'],
  },
});

Set the coordinates and any other relevant emulation inputs to values appropriate for your test. A shared test configuration is convenient when every page in the configured test context should receive the same location; use separate contexts or test-specific overrides when cases require different locations.

Choose Playwright or a protocol-level browser agent

For a local Playwright test or agent that already uses Playwright, the context API is the direct documented route. Chrome DevTools Protocol (CDP) is a lower-level alternative for agents that already issue protocol commands:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Route Location control Screenshot control Best fit and trade-off
Playwright Browser-context geolocation and permission configuration Page screenshot API Test scripts and browser agents using Playwright; requires a Playwright runtime.
Chrome DevTools Protocol A page geolocation override is listed in the protocol reference but marked deprecated Page.captureScreenshot, including format and clip options Agents already speaking CDP; lower-level control, with a method lifecycle to check before adoption.

For a new Playwright workflow, prefer Playwright’s documented geolocation API instead of building around CDP’s deprecated Page.setGeolocationOverride. See the CDP Page reference for the current protocol status and screenshot method.

Rank #4
Sale
Dual Electronics XGPS150A Portable Bluetooth GPS Receiver WAAS Universal
  • WIRELESS BLUETOOTH GPS & UNIVERSAL COMPATIBILITY - Instantly strengthen your GPS signal on iPhone, iPad, Android, Mac, or Windows. This water-resistant receiver connects via Bluetooth in seconds and works with the free GPS Status Tool app to provide high-precision coordinates and real-time position updates.
  • WIRELESS BLUETOOTH GPS & UNIVERSAL COMPATIBILITY - Instantly strengthen your GPS signal on iPhone, iPad, Android, Mac, or Windows. This water-resistant receiver connects via Bluetooth in seconds and works with the free GPS Status Tool app to provide high-precision coordinates and real-time position updates.
  • 8.5-HOUR BATTERY & COMPLETE ACCESSORY KIT - Built for long-range travel with 8.5 hours of continuous battery life. Each unit includes a USB charging cable, an adjustable wearable strap, and a secure non-slip pad designed to stick to vehicle dashboards, boat consoles, or cockpits to ensure the device stays in place.
  • RELIABLE HIGH-ACCURACY TRACKING & PERFORMANCE - Upgrade any mobile device into a professional navigator with a consistent GPS lock. This receiver is perfect for remote areas where internal device sensors fail, ensuring you maintain a stable signal and accurate positioning during critical missions, flights, or off-road trips.
  • EXTENDED 2-YEAR WARRANTY COVERAGE – Enjoy with peace of mind knowing your GPS unit is backed by a standard 1-year warranty. Gain an additional year of protection by registering your product, ensuring reliable, long-term support.

If an agent needs a hosted browser rather than a local Playwright runtime, Cloudflare documents Browser Run for inspecting and interacting with webpages using CDP. It is an optional deployment route, not a requirement for the local workflow. See Cloudflare Browser docs and its browser-agent example.

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

Or skip the browser setup

For a screenshot that does not require mocked browser geolocation, ScreenshotNeo can capture a URL with one API request. This is not a substitute for the Playwright workflow above when you need to set browser geolocation and verify how a page responds to it. ScreenshotNeo accepts a URL and returns a screenshot or PDF; its clean-shot steps can accept cookie or consent banners and remove known consent platforms, 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, and response headers report the page verdict and billing status.

For API details and options, see the ScreenshotNeo documentation. A cURL example:

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

ScreenshotNeo also has an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents using Claude, Cursor, or another MCP client. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up free for 1,000 screenshots a month—no card required.

Best Value
Sale
Garmin GLO 2 GPS and GLONASS Receiver for Precise Position Information on Mobile Devices, Black
  • Connects wirelessly to your mobile device: iPad, iPhone and other Bluetooth enabled smartphones, tablets and laptops to provide precise position information
  • Combines GPS and GLONASS satellite receivers for precise location data with Bluetooth Wireless Technology
  • It has up to 13 hours of battery life to keep your position on long trips
  • Suitable for pilots, mariners, hiking, cycling and the automotive industry
  • Charge Garmin Glo 2 easily with the included USB cable or optional 12/24 V vehicle power cable

Troubleshoot a location screenshot that looks wrong

The page shows a permission prompt or a geolocation error

  • Confirm that the context has permissions: ['geolocation'] and the intended geolocation values before the page uses the API.
  • Check that the page actually calls a browser location API. A site relying on IP-based location or its own stored location may not respond to the mocked coordinates.

The page shows the old location or a loading state

Wait for the location-dependent request or interface to finish before taking the screenshot. Use a condition tied to the feature—such as a results element appearing or its text changing—rather than treating navigation completion as proof that the location update has settled.

Geolocation is blocked in an embedded page

Browser permission is not the only gate. A page or embedding policy can restrict feature access, including for iframes. Chrome’s Permissions Policy documentation explains how policy controls access to features such as geolocation. Check the page and frame policy as well as the context permission. Chrome notes that users have the final decision to allow access to more powerful features in the documented context; automated browser testing can configure context permissions rather than relying on an interactive prompt.

The screenshot has the wrong scope or file

  • Decide whether you need the viewport or full document and set fullPage accordingly.
  • Set an explicit output path and confirm the script completed without an exception before treating the file as evidence.
  • If a downstream tool rejects the image, check which formats it supports and save in a compatible format.

A CDP geolocation command no longer works

Check the current CDP Page reference: Page.setGeolocationOverride is marked deprecated there. For a new Playwright-based capture, use Playwright’s context geolocation configuration instead.

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

Frequently Asked Questions

Does mocked browser geolocation prove where a visitor is?

No. It changes the coordinates available to the automated browser for testing; it does not verify a real person’s or device’s physical location.

Can Playwright change geolocation after navigation?

Yes. Use context.setGeolocation() and wait for the application to respond before capturing the updated state.

Will geolocation emulation change a site’s IP-based region?

No. Browser geolocation and IP-based location are separate inputs, and a site may rely on either or combine them.

Quick Recap

Bestseller No. 1
GlobalSat BU-353N USB GPS Receiver, Black, Made in Taiwan
GlobalSat BU-353N USB GPS Receiver, Black, Made in Taiwan
Android supported (app required); Built-In Roof Mount Magnet; 75-Channel All-In-View Trackin
$49.99
Bestseller No. 3
Dual Electronics XGPS160 Multipurpose Universal 5 Device Bluetooth GPS Receiver with Wide Area Augmentation System and Portable Attachment
Dual Electronics XGPS160 Multipurpose Universal 5 Device Bluetooth GPS Receiver with Wide Area Augmentation System and Portable Attachment
WAAS GPS receiver; Simultaneous GPS and GLONASS reception; Up to 10 position samples per second
$159.99
SaleBestseller No. 5
Garmin GLO 2 GPS and GLONASS Receiver for Precise Position Information on Mobile Devices, Black
Garmin GLO 2 GPS and GLONASS Receiver for Precise Position Information on Mobile Devices, Black
It has up to 13 hours of battery life to keep your position on long trips; Suitable for pilots, mariners, hiking, cycling and the automotive industry
$109.90

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.