0

I'm coding Selenium in Python and have the following issue:

selenium.common.exceptions.WebDriverException: Message: unknown error: >cannot create default profile directory

What I want to do is to use a different user to run my chromedriver, as my local user will not work in the wished URL.

I am trying to change the user showed in the following:

chrome_options.add_argument("user-data-dir=C:\\Users\\The user here i want to change\\Roaming\\Google\\Chrome\\User Data")

I have looked around and can't seem to find a solution. I have tried with this code:

chrome_options.add_argument("user-data-dir=my path for the user")
driver = webdriver.Chrome(executable_path=r'path for my webdriver', options=chrome_options)
driver.maximize_window()
driver.get(url)

But I keep getting an error.

  • Does this answer your question? [How to use certain Chrome profile with selenium python?](https://stackoverflow.com/questions/69246191/how-to-use-certain-chrome-profile-with-selenium-python) – user1525814 Mar 27 '23 at 12:36
  • It does not seem to be the same problem as my issue is with the root user, and not with a chrome user @user1525814 – Harris Ahmed Mar 27 '23 at 12:48
  • You have to set not only the `user-data-dir` but also the `profile-directory`, for example `chrome_options.add_argument('profile-directory=Profile 3')`. Moreover, you cannot use the default profile but you have to create a new one – sound wave Mar 28 '23 at 12:33

0 Answers0