Хочу открыть Хром определенного профиля, но выдает ошибку

IDOLyuk

Новичок
Пользователь
Дек 26, 2023
2
0
1
Код следующего характера:

Код:
import undetected_chromedriver as uc
import time
options = uc.ChromeOptions()
options.headless = False
options.add_argument(f"--user-data-dir=C:\\Users\\doluo\\AppData\\Local\\Google\\Chrome\\User Data")
options.add_argument(f'--profile-directory=Profile 1')
driver = uc.Chrome(options=options,use_subprocess=True)
driver.get("https://mail.google.com/mail/u/0/#inbox")
time.sleep(4)

Он открывает Хром нужного профиля, но дальше ничего не делает. Выводит в консоль следующее:

Код:
Traceback (most recent call last):
  File "c:/Users/doluo/OneDrive/Рабочий стол/атлас/Untitled-4.py", line 9, in <module>
    driver = uc.Chrome(options=options,use_subprocess=True)
  File "C:\Users\doluo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\undetected_chromedriver\__init__.py", line 466, in __init__
    super(Chrome, self).__init__(
  File "C:\Users\doluo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
    super().__init__(
  File "C:\Users\doluo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\chromium\webdriver.py", line 61, in __init__
    super().__init__(command_executor=executor, options=options)
  File "C:\Users\doluo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 209, in __init__
    self.start_session(capabilities)
  File "C:\Users\doluo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\undetected_chromedriver\__init__.py", line 724, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "C:\Users\doluo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 293, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
  File "C:\Users\doluo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 348, in execute
    self.error_handler.check_response(response)
  File "C:\Users\doluo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:26139
from chrome not reachable
Stacktrace:
        GetHandleVerifier [0x010A6EE3+174339]
        (No symbol) [0x00FD0A51]
        (No symbol) [0x00CE6E8A]
        (No symbol) [0x00CDC8A3]
        (No symbol) [0x00D0DE94]
        (No symbol) [0x00D07B12]
        (No symbol) [0x00D07927]
        (No symbol) [0x00D3E259]
        (No symbol) [0x00D3DBBA]
        (No symbol) [0x00D36DA6]
        (No symbol) [0x00D11034]
        (No symbol) [0x00D11F8D]
        GetHandleVerifier [0x01144B1C+820540]
        sqlite3_dbdata_init [0x012053EE+653550]
        sqlite3_dbdata_init [0x01204E09+652041]
        sqlite3_dbdata_init [0x011F97CC+605388]
        sqlite3_dbdata_init [0x01205D9B+656027]
        (No symbol) [0x00FDFE6C]
        (No symbol) [0x00FD83B8]
        (No symbol) [0x00FD84DD]
        (No symbol) [0x00FC5818]
        BaseThreadInitThunk [0x76027BA9+25]
        RtlInitializeExceptionChain [0x76F6BD2B+107]
        RtlClearBits [0x76F6BCAF+191]
 
Последнее редактирование:

IDOLyuk

Новичок
Пользователь
Дек 26, 2023
2
0
1
Изначально пробовал на selenium (но ошибка такая же):

Код:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.add_argument(r"--user-data-dir=C:\\Users\\doluo\\AppData\\Local\\Google\\Chrome\\User Data")
options.add_argument(r'--profile-directory=Profile 9')
driver = webdriver.Chrome(options=options)
driver.get("https://mail.google.com/mail/u/0/#inbox")
 
Последнее редактирование:

Форум IT Специалистов