首页 > 解决方案 > Chromedriver远程版本:87禁用'gelocation api'

问题描述

据我所知,selenium chromedriver remote 和本地版本中的某些功能不同。我正在尝试通过参数禁用地理定位 api,但遇到了一些问题。

我正在尝试通过使用以下命令并使用 Selenium 文档网站中为 python 提供的方法来禁用它

我目前正在调整远程 Chromedriver 的 87 版

https://www.selenium.dev/documentation/en/remote_webdriver/remote_webdriver_client/

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
options.add_argument("--disable-geolocation")
options.add_argument('--disable-search-geolocation-disclosure') # not sure if works
prefs = {"profile.default_content_setting_values.geolocation": 2}
options.add_experimental_option("prefs", prefs)

标签: pythonpython-3.xseleniumselenium-chromedriver

解决方案


推荐阅读