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.
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.
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