簡體   English   中英

嘗試在 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")

我認為您需要在路徑后加一個逗號,然后像這樣定義 chrome_options:

driver = webdriver.Chrome(executable_path='C:\\path\\to\\chromedriver', chrome_options=options)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM