fake Geolocation in chrome automation

前端 未结 4 1882
别跟我提以往
别跟我提以往 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:32

    You can use execute_cdp but that is not found in webdriver/remote/remote_connection.py so you could do the following:

    chrome_geolocation_format = {
                "location": {
                    "latitude": 50.1109,
                    "longitude": 8.6821
                }
    
    driver.execute(Command.SET_LOCATION, chrome_geolocation_format)
    

提交回复
热议问题