0

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

1 Answers1

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