python - chrome中特定用户的Python Chrome webdriver Selenium
问题描述
以下代码似乎提取了正确的 chrome 配置文件,但它似乎根本不起作用或提取指定的网页?任何想法如何在python中解决这个问题?
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.add_argument(r"--user-data-dir=C:\path\to\chrome\user\data") #e.g. C:\Users\You\AppData\Local\Google\Chrome\User Data
options.add_argument(r'--profile-directory=YourProfileDir') #e.g. Profile 3
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', chrome_options=options)
driver.get("https://www.google.co.in")
解决方案
推荐阅读
- github - 在 PR 合并后,有没有办法在另一个 repo 中的 PR 上触发 CircleCI 工作流程?
- sql - 在 PostgreSQL 中如何检索具有特殊字符和字母的列
- javascript - 使用 Javascript 显示每个按钮单击的 HTML 内容
- java - 将 Qute TypeSafe 模板与 Kotlin 一起使用时出现 java.lang.UnsatisfiedLinkError
- c++ - 在 Windows 上使用 _vscwprintf 处理 utf-8 编码字符串时失败
- python - 如何从 Celery/Django 流式传输 IOT 信号?
- google-apps-script - 从 Google 表格中的某个范围内查找值
- powershell - 即使指定 ExecutionPolicy 也无法运行 powershell 脚本
- c++ - 复制省略和普通可复制类型
- memory-management - 使用 ctypes 在 Python 中封装 Fortran 模块