I need to automate geolocation in chrome using python script. I have to fake the latitude and longitude. I followed some links in stackoverflow but they gave errors. chromeDriver.executeScript("window.navigator.geolocation.getCurrentPosition=function(success){var position = {"coords" : {"latitude": "555","longitude": "999"}};success(position);}");
is there any other way i can change the location?
Using Python with Selenium 3.141 and ChromeDriver 83.0
This is the working method I found:
params = {
"latitude": 34.0207305,
"longitude": -118.6919153,
"accuracy": 100
}
driver.execute_cdp_cmd("Emulation.clearGeolocationOverride", params)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With