python - 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)
解决方案
推荐阅读
- python - Python 子进程返回非零退出状态 1. 最小工作示例
- powershell - TravisCI 中的 Powershell 测试因缺少 RequiredModules 而失败
- python - 创建对象以进行测试的一些 Django 最佳实践是什么
- c++ - QSqlTableModel::setData() 也使用 Qt::EditMode 返回 false
- amazon-web-services - 让容器在弹性容器服务 (ECS) 中相互通信?
- selenium-webdriver - Selenium 2.53.1 似乎与 Firefox Quantum 64.0.2 不兼容
- javascript - 如何在严格模式下使用 RxJS fromEvent() 和 HammerJS
- python - 如何根据 Python 中类似定位的字符/模式对文件进行分组?
- python - 如何在python中打开一个名称附加日期的文件?
- git - 删除 git repo 中的文件夹?