Selenium Python,default profile is not loading after using ChromeDriverManager().install()

463 Views Asked by At

After switching to ChromeDriverManager().install(),I am not able to use default profile.Any workaround there so that I can avoid logging in every time?

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),....)

used many solutions found here, but still not working. directories: user-data-dir=C:\Users\xxx\AppData\Local\Google\Chrome\User Data user-data-dir=C:\Users\xxx\AppData\Local\Google\Chrome\User Data\Default

1

There are 1 best solutions below

2
On

To use the default profile, you have to mention the path like below:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options

options = Options()

# path of the chrome profile's parent directory
options.add_argument(r"user-data-dir=C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\User Data")
# name of the directory
options.add_argument("--profile-directory=Default")

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)