Test location-based features by overriding browser geolocation. Perfect for testing maps, location-based content, and geo-restricted features.
Override the browser's geolocation to test how your website behaves in different locations without physically being there. Useful for testing maps, location services, geo-restricted content, and store locators.
When to use geolocation?
Set the GPS coordinates (latitude and longitude) for the browser geolocation. Must provide both values together to override location.
-90 to 90-180 to 180const response = await fetch('https://www.snapshotai.dev/api/v1/screenshots', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://maps-app.com',
options: {
geolocation_latitude: 40.7128, // New York City
geolocation_longitude: -74.0060,
geolocation_accuracy: 10
}
})
});Set the accuracy radius in meters. Lower values indicate more precise location data.
numbermetersRecommended: Use 10-100 meters for realistic accuracy.
Quick reference for testing popular cities:
latitude: 40.7128
longitude: -74.0060latitude: 51.5074
longitude: -0.1278latitude: 48.8566
longitude: 2.3522latitude: 35.6762
longitude: 139.6503import requests
response = requests.post(
'https://www.snapshotai.dev/api/v1/screenshots',
headers={'Authorization': 'Bearer sk_live_YOUR_API_KEY'},
json={
'url': 'https://your-map-app.com',
'options': {
'geolocation_latitude': 37.7749, # San Francisco
'geolocation_longitude': -122.4194,
'geolocation_accuracy': 50,
'wait_for_selector': '#map-loaded'
}
}
)// Test store locator from different cities
const cities = [
{ name: 'NYC', lat: 40.7128, lng: -74.0060 },
{ name: 'LA', lat: 34.0522, lng: -118.2437 },
{ name: 'Chicago', lat: 41.8781, lng: -87.6298 }
];
for (const city of cities) {
await fetch('https://www.snapshotai.dev/api/v1/screenshots', {
method: 'POST',
body: JSON.stringify({
url: 'https://store-locator.com',
options: {
geolocation_latitude: city.lat,
geolocation_longitude: city.lng,
geolocation_accuracy: 100
}
})
});
}Use Realistic Accuracy Values
GPS typically provides 10-100m accuracy. Use values in this range for realistic testing.
Wait for Map Load
Use wait_for_selector or delay to ensure maps fully load before capturing.
Test Multiple Locations
Verify your app works correctly across different cities and countries.
Our team can help you test location-based features across different regions.
Contact Support