简体   繁体   English

尝试在 python 3.8 中使用 selenium 在我的个人资料上打开 chrome

[英]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.每次打开 chrome 时它都不在我的个人资料中,所以我没有保存所有的密码扩展名。 I searched for a while and this is what came out.我搜索了一会儿,结果是这样的。 Chrome still opens but it's not on my profile. Chrome 仍然打开,但它不在我的个人资料中。 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:我认为您需要在路径后加一个逗号,然后像这样定义 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