Sometimes our test scenarios require to fake geolocation. Now it’s a piece of cake with Selenium 4.
Here’s a simple test that opens Google Maps and changes geolocation:
Fake location
I noticed that it takes some time to apply geolocation changes. That’s why there should be some delays like sleep(2000);
.
Full code example is here.