5

How can I make webdriver_manager.chrome to use a custom chrome user profile?

I know for selenium webdriver I can specify like this:

options = Options()
options.add_argument(f'user-data-dir={script_path}\\User Data\\profile')
driver = webdriver.Chrome(executable_path=f'{script_path}\\chromedriver.exe', options=options)

But since I want to let chromedriver install the correct version on its own (because I sell my program to non python users) I am using the webdriver_manager module which looks like this:

driver = webdriver.Chrome(ChromeDriverManager().install())

Is there any way I could load a custom profile so that my log in data on websites is getting saved in my profile while using webdriver_manager?

1 Answer 1

7

You can use webdriver_manager.chrome and custom chrome user profile simultanously using the following solution:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

options = Options()
options.add_argument(f'user-data-dir={script_path}\\User Data\\profile')
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), options=options)
driver.get('https://www.google.com/')
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.