I do the following
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:/Users/bagher/AppData/Local/Google/Chrome/User Data")
options.add_argument('--profile-directory=Profile 1') #Path to your chrome profile
driver = webdriver.Chrome(service=driver_service,options=options)
driver.get("https://www.google.com")
But i get the error:
unknown error: Chrome failed to start: exited normally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
does anybody know how can i fix this error? more than 2 month i have issued this problem
first in java and i have to migrated to python now in python i still have this problem does anybody in this world can help me? i am really tired
I tried to reproduce the bug and succeeded. bug image So what caused the accident? When the User Data directory is used in the code, if Chrome has been opened, it will prompt that the directory is occupied.
Therefore, check whether you have manually opened a Chrome corresponding to the User Data directory when you run your code.