Getting Selenium 4.11 to open Chrome with different profile

69 views
Skip to first unread message

A V

unread,
Aug 28, 2023, 4:07:16 AM8/28/23
to Selenium Users
I have Selenium 4.11 with the latest version of ChromeDriver and Chrome, using python 3.11.5. Here is the code I am using to test Chrome opening up with a different profile. The code launches Chrome in the correct profile, but nothing happens. It doesnt go to "www.google.com". Any help is appriciated!

from selenium import webdriver

# Create an instance of the Options class
options = webdriver.ChromeOptions()

# Set the user data directory and profile directory
user_data_path = "C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data"
options.add_argument(f'--user-data-dir={user_data_path}')
options.add_argument('--profile-directory=Profile 2')

# Create a new Chrome webdriver instance with the specified options
driver = webdriver.Chrome(options=options)

driver.get("http://www.google.com")
Reply all
Reply to author
Forward
0 new messages