简体   繁体   中英

Trying to open chrome on my profile with selenium in python 3.8

Every time chrome opens it's not on my profile, so I don't have all of my saved passwords an extensions. I searched for a while and this is what came out. Chrome still opens but it's not on my profile. Can anyone tell me what I've done wrong?

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")

I think you need a comma after path and then define chrome_options like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM