首页 > 解决方案 > 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") 

标签: pythonfunctionseleniumgoogle-chromewebdriver

解决方案


推荐阅读