1

I'm using the code below to try and open a specific chrome profile. Chrome starts and loads the profile but it doesn't do anything else.

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

#create chromeoptions instance
options = webdriver.ChromeOptions()

#provide location where chrome stores profiles
options.add_argument(r"--user-data-dir=C:\\Users\\{user name}\\AppData\\Local\\Google\\Chrome\\User Data")
options.add_argument(r"--profile-directory=Profile 2")
#specify where your chrome driver present in your pc
driver = webdriver.Chrome(options=options)

#provide website url here
driver.get("https://www.google.co.in")

It also gives me the below output in the terminal.

Opening in existing browser session.
Traceback (most recent call last):
  File "C:\Users\path\bot2.py", line 11, in <module>
    driver = webdriver.Chrome(options=options)
  File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    super().__init__(
  File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
    super().__init__(
  File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
Backtrace:
        (No symbol) [0x00A86643]
        (No symbol) [0x00A1BE21]
        (No symbol) [0x0091DA9D]
        (No symbol) [0x0093F2A7]
        (No symbol) [0x0093A899]
        (No symbol) [0x00976917]
        (No symbol) [0x0097655C]
        (No symbol) [0x0096FB76]
        (No symbol) [0x009449C1]
        (No symbol) [0x00945E5D]
        GetHandleVerifier [0x00CFA142+2497106]
        GetHandleVerifier [0x00D285D3+2686691]
        GetHandleVerifier [0x00D2BB9C+2700460]
        GetHandleVerifier [0x00B33B10+635936]
        (No symbol) [0x00A24A1F]
        (No symbol) [0x00A2A418]
        (No symbol) [0x00A2A505]
        (No symbol) [0x00A3508B]
        BaseThreadInitThunk [0x753800F9+25]
        RtlGetAppContainerNamedObjectPath [0x77507BBE+286]
        RtlGetAppContainerNamedObjectPath [0x77507B8E+238]

I'm not sure what's wrong but it exits before opening the website.

Shaheen
  • 31
  • 6

0 Answers0