Skip to content Skip to sidebar Skip to footer

ChromeDriver Is Assuming That Chrome Has Crashed When Passing Profile Arguments

If any Chrome processes are running and the following code is run, Stack Overflow will NEVER load: options = webdriver.ChromeOptions() options.add_argument('user-data-dir=C:\\Users

Solution 1:

I'm not sure it is the same user-data-dir, but a different profile will lead to conflicts. I always use another user-data-dir with scripts.

-- But seeing your case I guess it is so.

Also BTW, to make life easier, why not just copy to some shorter directory address? --- say "C:\ChromeUserData".

And if you don't care about the old settings, you just specify user-data-dir to a new location. And Chrome will create the profile and things for you. (The directory specified needs to exist.)

For example:

options = webdriver.ChromeOptions()
options.add_argument("--user-data-dir=D:\\chromedriver\\UserDataDir") #Path to your chrome user-data/profile
options.add_argument('--disable-infobars') #disable the automation prompt bar
options.add_argument('--lang=en') #Set language to English
w = webdriver.Chrome(executable_path="D:\\chromedriver\\chromedriver.exe", chrome_options=options)

Given that D:\chromedriver\UserDataDir exists (or you create it first) and chromedriver.exe is at D:\chromedriver\chromedriver.exe.

By this way, you don't need to specify profile-directory any more. The script will create and use Default directory/profile inside D:\\chromedriver\\UserDataDir and save any changes you made.

Another tip: You can put chromedriver.exe in the directory of python.exe, thus to save the needs to specify executable_path, also will have fewer possible errors.

To make it more reliable, you can put these before above code snippets:

import os
uddPath = 'D:\\chromedriver\\UserDataDir'
if not os.path.exists(uddPath):
    os.makedirs(uddPath)

Solution 2:

Okay so the fix is to go to C:\Users\NAME\AppData\Local\Google\Chrome and duplicate your "User Data" folder and give it another name. Then just set your "user-data-dir" argument to the new folder.

# set up the chrome options to launch with the AUTO profile
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\RvBVakama\\AppData\\Local\\Google\\Chrome\\User Data AUTO")
options.add_argument('--profile-directory=Profile 1')
# start chrome with the driver
w = webdriver.Chrome('C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe', options=options)

enter image description here


Post a Comment for "ChromeDriver Is Assuming That Chrome Has Crashed When Passing Profile Arguments"