ChromeDriver "cannot create default profile directory"

Question:

I am using selenium with python, and I’m trying to use some arguments for starting the chromedriver.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options as ChromeOptions

def buildDriver():
    options = ChromeOptions()
    options.add_argument('--profile-directory="Default"')
    options.add_argument('--user-data-dir="C:/Temp/ChromeProfile"')
    browser = webdriver.Chrome(chrome_options=options)

driver = buildDriver()

I have not been able to find a solution to the following error:

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

Googling this error doesn’t result in anything meaningful, at least not for me.

Asked By: RattleyCooper

||

Answers:

Turns out you cannot use quotes when adding an argument.

options.add_argument('--profile-directory=Default')
options.add_argument('--user-data-dir=C:/Temp/ChromeProfile')

Notice that it’s --profile-directory=Default instead of --profile-directory="Default"

This is what fixed the issue for me.

Answered By: RattleyCooper

options.add_argument(‘–profile-directory=Default’)
options.add_argument(‘–user-data-dir=C:/Temp/ChromeProfile’)

i had the same issue and for me, a changed the — for ==

Answered By: Elyas

Check for disk space on temporary folder. On Windows is C:Users<username>AppDataLocalTemp. For Linux is: /tmp/

Answered By: user2846346