I try to set permission but nothing happends. I insert this code to devtools protocol monitor
{
"command":"Browser.grantPermissions",
"parameters":
{
"permissions": ["geolocation"]
}
}
I try to set permission but nothing happends. I insert this code to devtools protocol monitor
{
"command":"Browser.grantPermissions",
"parameters":
{
"permissions": ["geolocation"]
}
}
I experienced the same issue using Selenium + Python. Here is my setting:
chrome_driver.execute_cdp_cmd(
cmd="Browser.grantPermissions",
cmd_args={
"permissions": ["geolocation"]
}
)
chrome_driver.execute_cdp_cmd(
cmd="Emulation.setGeolocationOverride",
cmd_args={
"latitude": 37.7749,
"longitude": 122.4194,
"accuracy": 1000
}
)
I've used https://browserleaks.com/geo to test if geolocation identified or not.
After several tries and guesses I've found out that I never granted global MacOS permission to Chrome:
Go to MacOS -> System Preferences... -> Security & Privacy -> Location Services and enable location services for Chrome.
After this, the geolocation worked fine.