When I launch Chrome with Selenium like this...
from selenium import webdriver
driver = webdriver.Chrome("/path/to/chromedriver")
... I get a "clean" Chrome instance with no browsing history and none of my stored data from the normal installation of Chrome on my computer.
I want to open Chrome with Selenium but have the bookmarks, history, cookies, cache, etc. from my default Chrome installation available in the opened browser.
How can I do this?
You can use a specific profile or the default one as in your question:
How to open a new Default Browser Window in Chrome using Selenium in Python?
Here is a snip of a set up:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--user-data-dir=THE/PATH/TO/YOUR/PROFILE") # change to profile path
chrome_options.add_argument('--profile-directory=Profile 1')
browser = webdriver.Chrome(executable_path="PATH/TO/cromedriver.exe", chrome_options=chrome_options) # change the executable_path too
To find the path to the profile just type chrome://version/
in your default chrome browser and you will see it under Profile Path: in my PC it's "C:\Users\user\AppData\Local\Google\Chrome\User Data\Default"
Hope you find this helpful!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With