提问人:Stefano Baldi 提问时间:10/11/2020 更新时间:11/2/2020 访问量:199
尝试在 python 3.8 中使用 selenium 在我的个人资料上打开 chrome
Trying to open chrome on my profile with selenium in python 3.8
问:
每次打开 chrome 时,它都不在我的个人资料中,所以我没有所有保存的密码和扩展程序。 我找了一会儿,结果就是这样。 Chrome 仍然会打开,但它不在我的个人资料中。 谁能告诉我我做错了什么?
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
options = webdriver.ChromeOptions()
options.add_argument(r"user-data-dir=C:\Users\Utente\AppData\Local\Google\Chrome\User Data\Profile 1")
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("https://www.nike.com/it/launch?s=upcoming")
答:
0赞
presentformyfriends
11/2/2020
#1
我认为你需要在路径后面加一个逗号,然后像这样定义chrome_options:
driver = webdriver.Chrome(executable_path='C:\\path\\to\\chromedriver', chrome_options=options)
评论