Playwright provides geolocation support using latitude and longitude, however it only changes location at client. In my use-case, I need IP address needs along with APIs and urls so fetch and render content based on IP address
Asked
Active
Viewed 754 times
0
-
1That's more a network mock. You won't be able to accomplish that. – hardkoded Jun 06 '22 at 12:31
1 Answers
0
Playwright geolocation support is about emulating the geographic location of the client, as diplayed below:
const context = await browser.newContext({
geolocation: { longitude: 52.3456, latitude: 5.6789},
permissions: ['geolocation']
});
It is not possible to change the geolocation of the server, since you don't have control over the server. The only thing you can do is mock the server response, but that way you're not testing the actual server behavior, which seems to be what you want.

Bouke
- 1,531
- 1
- 12
- 21