How to Open a Chrome Profile Through --User-Data-Dir Argument of Selenium

Open Profile in Chrome Selenium

To fix this, change the add_argument line to (removing the spaces in the string):

CH_Option.add_argument("user-data-dir=C:/Users/Ali/AppData/Local/Google/Chrome/User Data/Default")

How to use certain Chrome profile with selenium python?

First of all


update your ChromeDriver to the latest version


(This part is mandatory).
Then pass two arguments --profile-directory=Profile 1 and user-data-dir=C:\\Users\\user123\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 16 to the Chrome binary

options = Options()
options.add_argument('--profile-directory=Profile 16')
options.add_argument("user-data-dir=C:\\Users\\Hana\\AppData\\Local\\Google\\Chrome\\User Data\\") #Path to your chrome profile
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe", options=options)

Note that in user-data-dir you should only pass the path of all profiles then the name of specific profile (Here, Profile 16) should be passed through --profile-directory

You can check out full source code named PythonChromeProfile in SeleniumWebDriver-Tiny_projects on Github, Which I tested successfuly. Also you can read about creating Chrome profiles and find the path to that profile Here



Related Topics



Leave a reply



Submit