I am trying to run the following code, but I encounter a Driver’s SessionNotCreatedException error.

Could you please have any ideaas how to specify a ChromeProfile when using Chrome For Testing?

Error Code:
Exception has occurred: SessionNotCreatedException
Message: session not created: Chrome failed to start: exited normally.
(session not created: DevToolsActivePort file doesn’t exist)
(The process started from chrome location C:WindowsSystem32chromewin64-120.0.6099.109chrome-win64chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

My Code:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

# set specify my profile
chrome_options = Options()
chrome_options.add_argument(r'user-data-dir=C:Users****AppDataLocalGoogleChromeUser Data')
chrome_options.add_argument('profile-directory=Profile 05')

# set Chrome folder
chrome_options.binary_location = r'C:WindowsSystem32chromewin64-120.0.6099.109chrome-win64chrome.exe'

# set ChromeDriver folder
driver_path = r'C:WindowsSystem32chromedriverwin64-120.0.6099.109chromedriver-win64chromedriver.exe'

# launch browser
driver = webdriver.Chrome(executable_path = driver_path, options=chrome_options)
# Open google
driver.get('https://www.google.co.jp/')

# waiting
time.sleep(3)

# close browser
driver.close()

I checked them below.. but seems not solved
・right folder pass
・could launch any website without specifying profile options.
 →it has launch Guest Mode. I want to launch with my profile.(not login)
・Im using same version(Chrome, Chrome Driver)

New contributor

TinyFish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.