mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs(nodejs): extend geolocation context examples (#17587)
This commit is contained in:
parent
a7f5f2d7a1
commit
cb1dcccbe6
@ -553,7 +553,35 @@ await using var context = await browser.NewContextAsync(new()
|
||||
|
||||
Change the location later:
|
||||
|
||||
```js
|
||||
```js tab=js-ts
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.use({
|
||||
geolocation: { longitude: 48.858455, latitude: 2.294474 },
|
||||
permissions: ['geolocation'],
|
||||
});
|
||||
|
||||
test('my test with geolocation', async ({ page, context }) => {
|
||||
// overwrite the location for this test
|
||||
context.setGeolocation({ longitude: 29.979097, latitude: 31.134256 });
|
||||
});
|
||||
```
|
||||
|
||||
```js tab=js-js
|
||||
const { test, expect } = require('@playwright/test');
|
||||
|
||||
test.use({
|
||||
geolocation: { longitude: 48.858455, latitude: 2.294474 },
|
||||
permissions: ['geolocation'],
|
||||
});
|
||||
|
||||
test('my test with geolocation', async ({ page, context }) => {
|
||||
// overwrite the location for this test
|
||||
context.setGeolocation({ longitude: 29.979097, latitude: 31.134256 });
|
||||
});
|
||||
```
|
||||
|
||||
```js tab=js-library
|
||||
await context.setGeolocation({ longitude: 29.979097, latitude: 31.134256 });
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user