Skip to content

[🐛 Bug]: Cannot create Chrome session with my own user profile #15724

Closed
@OngoingFee

Description

@OngoingFee

Description

I use Selenium to automate parts of my job that involve interacting with browser-based software. No remote server, just running it on my local machine. I pass Options my profile directory so that sites "remember" me, I can see/use bookmarks, etc. Code was working fine about 15 hours ago, and this morning it won't even create the session, even though I did nothing but turn my PC on. I've updated Selenium this morning in an attempt to fix this but no dice. Maybe it's a Chromedriver thing and not even a Selenium issue?

I am not a power user, so my apologies if this is a waste of anyone's time. But my work heavily relies on Selenium interaction and I'm baffled by this one since it's so basic. Any guidance is welcome, thanks.

Reproducible Code

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

options = Options()
options.add_argument(r"--user-data-dir=C:\Users\User\AppData\Local\Google\Chrome\User Data")
options.add_argument(r'--profile-directory=Default')
driver = webdriver.Chrome(options=options)
driver.get("https://www.google.com")
input("Press Enter to close the browser...")
driver.quit()

Debugging Logs

C:\Users\User\PycharmProjects\paraplanning\.venv\Scripts\python.exe C:\Users\User\AppData\Roaming\JetBrains\PyCharmCE2024.3\scratches\scratch.py 
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\JetBrains\PyCharmCE2024.3\scratches\scratch.py", line 7, in <module>
    driver = webdriver.Chrome(options=options)
  File "C:\Users\User\PycharmProjects\paraplanning\.venv\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        browser_name=DesiredCapabilities.CHROME["browserName"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        keep_alive=keep_alive,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\User\PycharmProjects\paraplanning\.venv\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 67, in __init__
    super().__init__(command_executor=executor, options=options)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\PycharmProjects\paraplanning\.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 260, in __init__
    self.start_session(capabilities)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "C:\Users\User\PycharmProjects\paraplanning\.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 357, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\PycharmProjects\paraplanning\.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 448, in execute
    self.error_handler.check_response(response)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\Users\User\PycharmProjects\paraplanning\.venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: DevToolsActivePort file doesn't exist
Stacktrace:
	GetHandleVerifier [0x00007FF66213CF25+75717]
	GetHandleVerifier [0x00007FF66213CF80+75808]
	(No symbol) [0x00007FF661F08F9A]
	(No symbol) [0x00007FF661F4B9D9]
	(No symbol) [0x00007FF661F46759]
	(No symbol) [0x00007FF661F41ADD]
	(No symbol) [0x00007FF661F952D8]
	(No symbol) [0x00007FF661F948B0]
	(No symbol) [0x00007FF661F87153]
	(No symbol) [0x00007FF661F50421]
	(No symbol) [0x00007FF661F511B3]
	GetHandleVerifier [0x00007FF66243D6FD+3223453]
	GetHandleVerifier [0x00007FF662437CA2+3200322]
	GetHandleVerifier [0x00007FF662455AD3+3322739]
	GetHandleVerifier [0x00007FF6621569FA+180890]
	GetHandleVerifier [0x00007FF66215E0FF+211359]
	GetHandleVerifier [0x00007FF662145274+109332]
	GetHandleVerifier [0x00007FF662145422+109762]
	GetHandleVerifier [0x00007FF66212BA39+4825]
	BaseThreadInitThunk [0x00007FF955C4E8D7+23]
	RtlUserThreadStart [0x00007FF9572514FC+44]


Process finished with exit code 1

ℹ️ Last known working version: 4.29

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!C-pyPython BindingsD-chromeI-defectSomething is not working as intendedI-questionApplied to questions. Issues should be closed and send the user to community resources.I-regressionSomething was working but we "fixed" itOS-windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions