0

I am running python program with Selenium to automate browser page processing. In order to open the pages correctly, I need to use my login and password saved in the Chrome user profile for my website. I created a new Chrome profile for that purpose. However, the program cannot read my user profile data for some reason. Here is the start of my python program:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time, os

CHROME_USER_DIR = "C:/Users/LocalUserName/AppData/Local/Google/Chrome/User Data"
PROFILE_NAME = "Profile 1"

options = Options()
options.add_argument(f"--user-data-dir={CHROME_USER_DIR}")
options.add_argument(f"--profile-directory={PROFILE_NAME}")
driver = webdriver.Chrome(options=options)

I get the following error:

DevTools remote debugging requires a non-default data directory. Specify this using --user-data-dir.
[12252:10400:0601/205536.845:ERROR:gpu\ipc\service\gpu_channel_manager.cc:946] Failed to create GLES3 context, fallback to GLES2.
[12252:10400:0601/205536.845:ERROR:gpu\ipc\service\gpu_channel_manager.cc:957] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[12252:10400:0601/205536.960:ERROR:gpu\ipc\service\gpu_channel_manager.cc:946] Failed to create GLES3 context, fallback to GLES2.
[12252:10400:0601/205536.960:ERROR:gpu\ipc\service\gpu_channel_manager.cc:957] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[12252:10400:0601/205536.960:ERROR:gpu\ipc\service\gpu_channel_manager.cc:946] Failed to create GLES3 context, fallback to GLES2.
[12252:10400:0601/205536.960:ERROR:gpu\ipc\service\gpu_channel_manager.cc:957] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[6180:10560:0601/205539.087:ERROR:chrome\browser\policy\cloud\fm_registration_token_uploader.cc:179] Client is missing for kUser scope
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1748800539.099043    2104 voice_transcription.cc:58] Registering VoiceTranscriptionCapability
Created TensorFlow Lite XNNPACK delegate for CPU.
[6180:5096:0601/205539.234:ERROR:google_apis\gcm\engine\registration_request.cc:291] Registration response error message: DEPRECATED_ENDPOINT
[6180:1708:0601/205539.382:ERROR:components\system_cpu\cpu_probe_win.cc:112] PdhAddEnglishCounter failed for '\Processor(_Total)\% Processor Time': Error (0x13D) while retrieving error. (0xC0000BB8)
[6180:1864:0601/205539.382:ERROR:components\system_cpu\cpu_probe_win.cc:112] PdhAddEnglishCounter failed for '\Processor(_Total)\% Processor Time': Error (0x13D) while retrieving error. (0xC0000BB8)
[6180:1708:0601/205551.758:ERROR:components\system_cpu\cpu_probe_win.cc:112] PdhAddEnglishCounter failed for '\Processor(_Total)\% Processor Time': Error (0x13D) while retrieving error. (0xC0000BB8)
[6180:5096:0601/205605.808:ERROR:google_apis\gcm\engine\registration_request.cc:291] Registration response error message: DEPRECATED_ENDPOINT
[6180:1708:0601/205606.768:ERROR:components\system_cpu\cpu_probe_win.cc:112] PdhAddEnglishCounter failed for '\Processor(_Total)\% Processor Time': Error (0x13D) while retrieving error. (0xC0000BB8)
[6180:1708:0601/205621.778:ERROR:components\system_cpu\cpu_probe_win.cc:112] PdhAddEnglishCounter failed for '\Processor(_Total)\% Processor Time': Error (0x13D) while retrieving error. (0xC0000BB8)
[6180:1708:0601/205636.778:ERROR:components\system_cpu\cpu_probe_win.cc:112] PdhAddEnglishCounter failed for '\Processor(_Total)\% Processor Time': Error (0x13D) while retrieving error. (0xC0000BB8)
Traceback (most recent call last):
  File "D:\Work\script_runner.py", line 38, in <module>
    driver = webdriver.Chrome(options=options)
  File "C:\Users\LocalUserName\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 47, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        browser_name=DesiredCapabilities.CHROME["browserName"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        keep_alive=keep_alive,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\LocalUserName\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 69, in __init__
    super().__init__(command_executor=executor, options=options)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\LocalUserName\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 257, in __init__
    self.start_session(capabilities)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "C:\Users\LocalUserName\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 356, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\LocalUserName\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 447, in execute
    self.error_handler.check_response(response)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\Users\LocalUserName\AppData\Local\Programs\Python\Python313\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
from chrome not reachable
Stacktrace:
        GetHandleVerifier [0x0x7ff7c0f26f65+78965]
        GetHandleVerifier [0x0x7ff7c0f26fc0+79056]
        (No symbol) [0x0x7ff7c0cb9c0c]
        (No symbol) [0x0x7ff7c0caaa41]
        (No symbol) [0x0x7ff7c0cfceb2]
        (No symbol) [0x0x7ff7c0cf7a78]
        (No symbol) [0x0x7ff7c0cf297d]
        (No symbol) [0x0x7ff7c0d465be]
        (No symbol) [0x0x7ff7c0d45d50]
        (No symbol) [0x0x7ff7c0d38443]
        (No symbol) [0x0x7ff7c0d01311]
        (No symbol) [0x0x7ff7c0d020a3]
        GetHandleVerifier [0x0x7ff7c11de26d+2926461]
        GetHandleVerifier [0x0x7ff7c11d8993+2903715]
        GetHandleVerifier [0x0x7ff7c11f6aed+3026941]
        GetHandleVerifier [0x0x7ff7c0f416fe+187406]
        GetHandleVerifier [0x0x7ff7c0f496ef+220159]
        GetHandleVerifier [0x0x7ff7c0f2faf4+114692]
        GetHandleVerifier [0x0x7ff7c0f2fca9+115129]
        GetHandleVerifier [0x0x7ff7c0f164d8+10728]
        BaseThreadInitThunk [0x0x7ff82e307374+20]
        RtlUserThreadStart [0x0x7ff82f9dcc91+33]

Note that when I run the same program without the lines:

options.add_argument(f"--user-data-dir={CHROME_USER_DIR}")
options.add_argument(f"--profile-directory={PROFILE_NAME}")

The program runs correctly, except the website is not displaying the gage correctly as it did not log in with my username/password.

I already checked the following: ChromeDriver and Chrome have the same version. I do not use any other apps with my Chrome profile while running the program.

Any ideas what goes wrong and how to fix it?

2
  • 1
    they did make some changes v137 and up. As you can see in the error, you can't use the default user-data-dir.... (leaving out that flag should let it create it's own fresh directory. You could specify one, but it'd be essentially the same as leaving it out.) You might try only setting the profile-directory, and/or create a new profile manually, log it in to whatever sites you are testing, and choose that for profile-directory. It's worth a try anyway... (they've increased security regarding saved cookies) Commented Jun 2 at 16:29
  • 1
    these were changes in Chrome browser, btw, not the driver. Also see here: developer.chrome.com/blog/remote-debugging-port Commented Jun 3 at 15:53

2 Answers 2

1

This issue is likely due to a recent Chrome security change explained here - Selenium 4.32.0 does open chrome but doesn't load the URL using my default profile for persistent login

If it's necessary to use an actual profile, here's a workaround by using Chrome For Testing - https://issues.chromium.org/issues/417456892

Sign up to request clarification or add additional context in comments.

Comments

1

I am seeing the same error. This is a new error because my code worked just a few days ago. I am also using Selenium with options:

options = webdriver.ChromeOptions()
options.add_argument('--headless=new')
options.add_argument('ignore-certificate-errors')
options.add_experimental_option('excludeSwitches', ['enable-logging'])
browser = webdriver.Chrome(options=options)

Hopefully, someone knows a workaround.

2 Comments

Yeah, and when I commented out the line with "user-data-dir=" the error was gone, except it was no longer using my browser cookies and profile data. Could this because it no longer knows hoe to read the path?
I found a workaround by using Chrome for Testing instead of usual Chrome web browser. The mentioned restriction is not applied there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.