How to load default profile in chrome using Python Selenium Webdriver?

So, I would like to open chrome with its default profile using pythons webdriver. I tried everything I could find, but I still could not get it to work. Thanks for the help!

+13
source share
1 answer

Here is what finally made me work for me.

from selenium import webdriver

options = webdriver.ChromeOptions() 
options.add_argument("user-data-dir=C:\\Path") #Path to your chrome profile
w = webdriver.Chrome(executable_path="C:\\Users\\chromedriver.exe", chrome_options=options)

To find the path to the chromium profile data, you need to enter chrome://version/in the address bar. E.g. mine is displayed as C:\Users\pc\AppData\Local\Google\Chrome\User Data\Default, to use it in the script, I had to exclude it \Default\, so we only finish C:\Users\pc\AppData\Local\Google\Chrome\User Data.

, : , , .

+29

Source: https://habr.com/ru/post/1658331/


All Articles