python - Python Chrome 驱动程序配置文件问题
问题描述
在最新的 chrome 版本更新中打开特定的 Chrome 配置文件时出现问题。我正在将 Python 与 chromedriver(版本 91)一起使用。大约一周前,Chrome 发布了一个新更新,似乎在打开特定 Chrome 配置文件的情况下使稳定的 chromedriver 版本无效。
我的目标:使用我的程序打开具有特定配置文件(配置文件 1)的 Chrome。
我的问题:我将 chrome 配置文件 1 固定到任务栏,并且程序成功打开了该窗口,但它不会自动登录到该 Chrome 配置文件 1。
这是我的代码:
PATH = ("chromedriver.exe")
chrome_options = webdriver.ChromeOptions();
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs",prefs)
chrome_options.add_argument("--user-data-dir=C:\\Local\\Google\\Chrome\\User Data")
chrome_options.add_argument("--profile-directory= Profile 1")
chrome_options.add_argument("start-maximized");
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation']);
driver = webdriver.Chrome(PATH, options=chrome_options);
driver.get(brandURL)
系统信息:Windows 10(10.0.18363 Build 18363)Chrome 版本 91.0.4472.114 Chrome 驱动程序 91.0.4472.101
为澄清起见,此代码在最新的 Chrome 更新之前运行良好。
我的问题:我可以在我的程序内部做些什么来使这个功能像以前一样?我应该寻找一种替代方法来降级我的 Chrome 版本吗?
非常感谢您的帮助-我真的很难弄清楚这一点。
谢谢
解决方案
推荐阅读
- python - 如何合并两个熊猫数据框并按数据框中的数字记录排序?
- php - 我正在尝试与 XAMPP 和 MySQL 服务器进行简单连接,但是每当我尝试输入数据或连接到数据库时
- r - 如果在 R 中相似(两列),则将一个数据(三列)中的一列添加到另一个数据集(两列)
- javascript - 我是否在下面的 javascript 代码中正确实现了二进制搜索的概念
- angularjs - 使用Express从angularJS应用程序向nodeJS服务器发出带有参数和一些数据的put请求
- python - 使用 Python 下载许多图像的最佳策略?
- amazon-web-services - AWS Amplify 克隆存储库错误:“SSR 应用程序不支持基本身份验证。”
- twilio - Twilio 任务路由器 - 如何将分配的任务转移给其他工作人员?
- typescript - 类型“typeof videojs”上不存在属性“扩展”
- logging - Grafana:如何区分提醒和警报