title | excerpt |
---|---|
setGeolocation(geolocation) |
Sets the BrowserContext's geolocation. |
This feature has known issues. For details, refer to #435.
Sets the context's geolocation.
Parameter | Type | Default | Description |
---|---|---|---|
geolocation | object | null |
|
geolocation.latitude | number | 0 |
Latitude between -90 and 90. |
geolocation.longitude | number | 0 |
Latitude between -180 and 180. |
geolocation.accuracy | number | 0 |
Optional non-negative accuracy value. |
import { chromium } from 'k6/experimental/browser';
export default function () {
const browser = chromium.launch();
const context = browser.newContext();
context.setGeolocation({ latitude: 59.95, longitude: 30.31667 });
}