fake Geolocation in chrome automation

前端 未结 4 1833
别跟我提以往
别跟我提以往 2021-01-16 23:07

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.

4条回答
  •  爱一瞬间的悲伤
    2021-01-16 23:45

    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)
    

提交回复
热议问题