Python Selenium Change Geolocation

413 Views Asked by At

I am trying to trick the Python chromedriver to make it believe that it is running in a different city.

It appears someone has found an answer for this in JavaScript, but I was wondering if it is possible to adapt it for Python using Selenium:

chromeDriver.executeScript("window.navigator.geolocation.getCurrentPosition = 
    function(success){
         var position = {"coords" : {
                                       "latitude": "30.9843", 
                                       "longitude": "91.9623"
                                     }
                         }; 
         success(position);}");

I tried all the suggested answers here, but none of them worked in Python.

Any help is much appreciated!

0

There are 0 best solutions below