Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.13 KB

File metadata and controls

40 lines (28 loc) · 1.13 KB
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.

Example

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 });
}