Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Selenium SessionNotCreatedException: "User data directory is already in use" when running as root #15327

Open
ammarft-ai opened this issue Feb 24, 2025 · 48 comments

Comments

@ammarft-ai
Copy link

What happened?

I am trying to launch a headless Chrome WebDriver using Selenium in Python. However, I keep encountering this error:

How can we reproduce the issue?

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

def createModel():
    service = Service(ChromeDriverManager().install())
    options = webdriver.ChromeOptions()
    
    # Specifying user data directory
    options.add_argument("--user-data-dir=/root/video-downloader/tmp/selenium-user-data")  
    options.add_argument("--headless=new")
    options.add_argument("--start-maximized")

    driver = webdriver.Chrome(service=service, options=options)
    return driver

driver = createModel()
driver.get("https://www.google.com")
print(driver.title)
driver.quit()

Relevant log output

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: probably user data directory is already in use, 
please specify a unique value for --user-data-dir argument, or don't use --user-data-dir

Operating System

Ubuntu

Selenium version

4.29.0

What are the browser(s) and version(s) where you see this issue?

Chrome

What are the browser driver(s) and version(s) where you see this issue?

Google Chrome 133.0.6943.126 ChromeDriver stable(auto)

Are you using Selenium Grid?

No response

Copy link

@ammarft-ai, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Feb 24, 2025

I am not sure how we can help. You need to make sure the profile is not being used.

@cgoldberg
Copy link
Contributor

This could be caused by trying to access a profile that's already in use, or if the profile is not readable/writeable (yours seems to be owned by root?)

Either way, the error message is coming from chromedriver, so I don't think there is anything to fix from the selenium side.

@kiyotsu
Copy link

kiyotsu commented Feb 25, 2025

It also occurs in my environment.
I am running my tool with administrator privileges.
This error does not occur except when running as administrator.
I assume that an Edge version update triggers this error.

OS:Windows10
language:c#

@thepbnk
Copy link

thepbnk commented Feb 25, 2025

It also occurs in my environment. I am running my tool with administrator privileges. This error does not occur except when running as administrator. I assume that an Edge version update triggers this error.

OS:Windows10 language:c#

I don't know the cause, but I avoided the error by running msedgedriver.exe before initializing the driver.

  • Environment where it occurred
  • OS: Windows 10
  • c# Selenium Webdriver 4.2.0
  • msedge: 133.0.6943.127

static void Main()
        {
            string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string exeDirectory = Path.GetDirectoryName(exePath);
            String GetDrivePath = exeDirectory;
            String driverFileName = "msedgedriver.exe";


            EdgeDriverService eds = EdgeDriverService.CreateDefaultService(GetDrivePath, driverFileName);
            eds.HideCommandPromptWindow = true;
            eds.SuppressInitialDiagnosticInformation = true;

            StartProcessAsStandardUser(GetDrivePath + "\\" + driverFileName, eds.Port);

            System.Threading.Thread.Sleep(1000);
            EdgeOptions options = GetBrowserOption;
            string navigateUrl = "https://www.google.com";
            using (var driver = new EdgeDriver(eds, options))
            {
                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2);
                driver.Navigate().GoToUrl("about:blank");
                driver.Navigate().GoToUrl(navigateUrl);
            }
        }

public static void StartProcessAsStandardUser(string fileName, int port)
        {

            ProcessStartInfo psi = new ProcessStartInfo
            {
                FileName = "runas.exe",
                Arguments = $"/trustlevel:0x20000 \"{fileName} --port={port}\"",
                UseShellExecute = true,
                CreateNoWindow = true,
                WindowStyle = ProcessWindowStyle.Hidden
            };

            try
            {
                psi.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
                var proc = Process.Start(psi);
            }
            catch (Exception ex)
            {

            }
        }

@cgoldberg
Copy link
Contributor

Try running chromdriver.exe from the command line, passing it the --user-data-dir argument and supplying the location of your profile. That will verify this is an issue with ChromeDriver and not selenium.

However, since the error is coming from ChromeDriver... this doesn't look like a selenium issue and it should reported to the ChromeDriver devs.

@cgoldberg
Copy link
Contributor

@thepbnk

Why are you running as Admin?

Also, the reported issue was for Chrome, not Edge.

@thepbnk
Copy link

thepbnk commented Feb 26, 2025

@cgoldberg
Running it with administrator rights was a method I found while looking for a way to reproduce the error.

The PC where the error occurred did not have administrator rights, but it did occur. And I was able to avoid the error with this method.

Although it is a Chrome issue, I thought that a similar method could be used, so I left a comment.

@VietND96
Copy link
Member

VietND96 commented Feb 26, 2025

I am running my tool with administrator privileges.
This error does not occur except when running as administrator.

If running as admin (in Windows) or with sudo (in Linux), can you try to pass browser arg --no-sandbox to see any help?
Refer to https://stackoverflow.com/a/70385974/14532601, #14609 (comment)

@Venousek
Copy link

I can confirm this exact issue as well, both in Debian Bullseye running in docker container as well as in Ubuntu installed in WSL.

selenium 4.29.0 installed in conda environment through pip.

@stanislaw
Copy link

Can confirm this issue when running as a root user from an Ubuntu 24-based Docker container. This issue does not occur when running from a non-root user.

@cgoldberg
Copy link
Contributor

I was able to reproduce this on Debian, but only running as root.

I get the same exception reported in this issue when trying to instantiate webdriver.Chrome or webdriver.Edge, and a slightly different failure with webdriver.Firefox.

The repro steps are simply:

$ sudo su

Then run a Python script containing:

from selenium import webdriver
driver = webdriver.Chrome()

Here is a Python shell session showing all 3 failures:

(venv) root@penguin:/home/cgoldberg617/code# python3
Python 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> driver = webdriver.Chrome()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 250, in __init__
    self.start_session(capabilities)
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 342, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "/home/cgoldberg617/code/venv/lib/python3.11/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: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Stacktrace:
#0 0x5561c9c5614a <unknown>
#1 0x5561c96f3b80 <unknown>
#2 0x5561c972d03f <unknown>
#3 0x5561c9728d7f <unknown>
#4 0x5561c9779819 <unknown>
#5 0x5561c9778d46 <unknown>
#6 0x5561c976aca3 <unknown>
#7 0x5561c9736f08 <unknown>
#8 0x5561c9738071 <unknown>
#9 0x5561c9c1fb5b <unknown>
#10 0x5561c9c23ae2 <unknown>
#11 0x5561c9c0b967 <unknown>
#12 0x5561c9c246d4 <unknown>
#13 0x5561c9befc7f <unknown>
#14 0x5561c9c44cd8 <unknown>
#15 0x5561c9c44ea9 <unknown>
#16 0x5561c9c54fc6 <unknown>
#17 0x7f70603ee1c4 <unknown>

>>> driver = webdriver.Edge()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/edge/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 250, in __init__
    self.start_session(capabilities)
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 342, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "/home/cgoldberg617/code/venv/lib/python3.11/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: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Stacktrace:
#0 0x55d1fdf4114e <unknown>
#1 0x55d1fd9b1d46 <unknown>
#2 0x55d1fd9ed47f <unknown>
#3 0x55d1fd9e6a8d <unknown>
#4 0x55d1fda36a03 <unknown>
#5 0x55d1fda35b2f <unknown>
#6 0x55d1fda27273 <unknown>
#7 0x55d1fd9f4bb0 <unknown>
#8 0x55d1fd9f5841 <unknown>
#9 0x55d1fdf14a61 <unknown>
#10 0x55d1fdf17c7e <unknown>
#11 0x55d1fdf176fb <unknown>
#12 0x55d1fdf180a5 <unknown>
#13 0x55d1fdf06492 <unknown>
#14 0x55d1fdf1846c <unknown>
#15 0x55d1fdeef225 <unknown>
#16 0x55d1fdf31a28 <unknown>
#17 0x55d1fdf31c48 <unknown>
#18 0x55d1fdf4055c <unknown>
#19 0x7f2df31701c4 <unknown>

>>> driver = webdriver.Firefox()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 250, in __init__
    self.start_session(capabilities)
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 342, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "/home/cgoldberg617/code/venv/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 232, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1

>>> 

Here is what happens when trying to just run Chrome as root:

(venv) root@penguin:/home/cgoldberg617/code# ~/.cache/selenium/chrome/linux64/133.0.6943.141/chrome
[6856:6856:0227/140357.019460:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

Here is what happens when trying to run Chrome as root and including the --no-sandbox option:

(venv) root@penguin:/home/cgoldberg617/code# ~/.cache/selenium/chrome/linux64/133.0.6943.141/chrome --no-sandbox
No protocol specified

[6863:6863:0227/140411.630874:ERROR:ozone_platform_x11.cc(245)] Missing X server or $DISPLAY
[6863:6863:0227/140411.631036:ERROR:env.cc(257)] The platform failed to initialize.  Exiting.

Here is what happens when trying to run Firefox as root:

(venv) root@penguin:/home/cgoldberg617/code# ~/.cache/selenium/firefox/linux64/135.0.1/firefox
No protocol specified

Error: cannot open display: :0

I definitely have an X server running... and here is the contents of $DISPLAY:

(venv) root@penguin:/home/cgoldberg617/code# echo $DISPLAY
:0

So... I would say that this is not a bug in Selenium, ChromeDriver, EdgeDriver, or GeckoDriver. It is an issue with running Chrome/Edge/Firefox as root. I don't know the cause. Perhaps a bug in the browsers? Perhaps it's because root can't open an X display running as a regular user?

Regardless, the real question is WHY do you need to run Selenium (and therefore the browser and driver) as root? I can't think of a valid use case for this... but maybe someone has one.

@tianmrn95
Copy link

tianmrn95 commented Feb 27, 2025

I was having this error when trying to run the driver inside a Docker Container (python:3.10-slim). Adding the --user-data-dir as an argument solved the issue in this case.

options = ChromeOptions()
options.add_argument("--headless")
options.add_argument("--user-data-dir=/tmp/user-data")
options.add_argument("--no-sandbox")
driver = webdriver.Chrome(options=options)

@cgoldberg
Copy link
Contributor

cgoldberg commented Feb 27, 2025

@tianmrn95 @stanislaw @Venousek @thepbnk

Interesting. Were you running as root or a regular user in the container when getting the error?

To decouple this from selenium, can you run chrome directly inside your container (just start the browser from the command line without selenium)? Verify it doesn't work, then add the --user-dat-dir argument and verify it does work?

With that information, someone can submit a bug to Chrome/Edge and see what they say about running the browser as root.


I guess this the use case I was looking for. Docker containers run as UID 0 (root) by default. That seems like bad practice, but I guess it's common... so that makes it a valid use case for running selenium as an elevated/root user.

@cgoldberg cgoldberg changed the title [🐛 Bug]: Selenium SessionNotCreatedException: "User data directory is already in use" [🐛 Bug]: Selenium SessionNotCreatedException: "User data directory is already in use" when running as root Feb 27, 2025
@caborabo
Copy link

I'm having this same issue. Running in a docker container tried combinations of FROM python:3.10-slim, FROM python:3.9-13-slim, root user, non-root user, with and without --user-data-dir.

2025-02-27 15:25:01 Attempting to get Chrome driver
2025-02-27 15:25:20 WebDriverException getting Chrome driver: Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
2025-02-27 15:25:20 Stacktrace:
2025-02-27 15:25:20 #0 0x555555faf14a <unknown>
2025-02-27 15:25:20 #1 0x555555a4cb80 <unknown>
2025-02-27 15:25:20 #2 0x555555a8603f <unknown>
2025-02-27 15:25:20 #3 0x555555a81d7f <unknown>
2025-02-27 15:25:20 #4 0x555555ad2819 <unknown>

Running chromedriver directly in the container via docker exec works just fine:

$ chromedriver
Starting ChromeDriver 133.0.6943.141 (2a5d6da0d6165d7b107502095a937fe7704fcef6-refs/branch-heads/6943@{#1912}) on port 0
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 42851.
^C
$ chromedriver --headless=new --no-sandbox --user-data-dir=/app/foo
Starting ChromeDriver 133.0.6943.141 (2a5d6da0d6165d7b107502095a937fe7704fcef6-refs/branch-heads/6943@{#1912}) on port 0
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 42507.

@cgoldberg
Copy link
Contributor

@caborabo

I don't think executing chromedriver alone would reproduce this, because it's just waiting for a command to launch chrome, and that is when the issue occurs.

Can you try launching chrome directly (not chromedriver) inside your container , both with and without the --user-data-dir arg, as root and non-root user?

@caborabo
Copy link

Thank you for the for the suggestion!! Apparently there are quite a few libraries required by Chrome that must be installed in the python docker images. Once installed it all works. Below is the first part of the dockerfile I used that pulls the latest stable chrome and chromedriver, and install the required libraries.

Just a suggestion -- if chrome fails to start, a more appropriate error message would save a ton of time.

FROM python:3.10-slim AS pybase

# Install necessary tools
RUN apt-get update && apt-get install -y \
    wget \
    unzip \
    libnss3 \
    libglib2.0-0 \
    libxcb1 \
    libx11-6 \
    libx11-xcb1 \
    libxcomposite1 \
    libxcursor1 \
    libxdamage1 \
    libxext6 \
    libxfixes3 \
    libxi6 \
    libxrandr2 \
    libxrender1 \
    libxss1 \
    libxtst6 \
    libfontconfig1 \
    libpango1.0-0 \
    libcairo2 \
    libcups2 \
    libdbus-1-3 \
    libexpat1 \
    libuuid1 \
    libxkbcommon0 \
    libxshmfence1 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libatspi2.0-0 \
    libgbm1 \
    libasound2 \
    libatk1.0-0 \
    libcups2 \
    libdbus-1-3 \
    libgconf-2-4 \
    libgdk-pixbuf2.0-0 \
    libgtk-3-0 \
    jq

# Fetch the latest stable versions of Chrome and ChromeDriver
RUN LATEST_JSON=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json) && \
    CHROME_URL=$(echo $LATEST_JSON | jq -r '.channels.Stable.downloads.chrome[] | select(.platform == "linux64") | .url') && \
    CHROMEDRIVER_URL=$(echo $LATEST_JSON | jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64") | .url') && \
    export CHROMEDRIVER_VERSION=$(echo $LATEST_JSON | jq -r '.channels.Stable.version') && \
    echo "$CHROMEDRIVER_VERSION" >> /etc/cdvers && \
    wget -O /tmp/chrome-linux64.zip $CHROME_URL && \
    wget -O /tmp/chromedriver-linux64.zip $CHROMEDRIVER_URL

# Unzip Chrome and ChromeDriver
RUN unzip /tmp/chrome-linux64.zip -d /opt/ && \
    unzip /tmp/chromedriver-linux64.zip -d /opt/ && \
    mv /opt/chrome-linux64 /opt/chrome && \
    mv /opt/chromedriver-linux64/chromedriver /usr/local/bin/

# Set environment variables
ENV PATH="/opt/chrome:$PATH"
ENV DISPLAY=:99

@cgoldberg
Copy link
Contributor

@caborabo

So your issue was just that you didn't have the necessary dependencies in your container to run chrome? That seems totally unrelated to the issue being discussed here (although you probably saw a similar error message).

Unfortunately, Selenium can only provide whatever error message ChromeDriver returns when Chrome doesn't start.

FWIW, you don't need to download and install Chrome/ChromeDriver like you are doing. It is done automatically through Selenium Manager.

@tianmrn95
Copy link

tianmrn95 commented Feb 28, 2025

@cgoldberg Indeed, my Docker container is running with root privileges. After some debugging, I found that adding --user-data-dir was not the solution in my case, but using --no-sandbox was.

My issue seems to be related to running Chrome as root without the --no-sandbox option (see this issue).

When trying to run the Chrome command:

As non-root:

FATAL:zygote_host_impl_linux.cc(127)] No usable sandbox! If you are running on Ubuntu 23.10+ or another Linux distro that has disabled unprivileged user namespaces with AppArmor, see https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md. Otherwise see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the (older) SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.

As root:

ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

It looks like this issue is already being discussed here: https://issues.chromium.org/issues/373753919.

@yash-learner
Copy link

For me, changing from the old to new headless option fixed this error, options.add_argument("--headless=new") in a rails app 🤷‍♂️

stanislaw added a commit to strictdoc-project/strictdoc that referenced this issue Mar 3, 2025
…er user

This done to implement the following constraints:

1) The Docker container runs a non-root user because otherwise
   Chrome/ChromeDriver are not happy as per this issue:
   SeleniumHQ/selenium#15327

2) StrictDoc runs within a container and outputs artifacts that have the
   UID/GID of the host user.

The approaches that I could not make work:

1) Running with a default root user because of the permissions issue and
   Chrome raising an error about the environment.

2) Using `USER` inside the container and then running an image with `--user $(id
   -u):$(id -g)`. With this approach, the Chrome would not be happy
   because the container will be running from a user that does not have
   a proper home directory.

Maybe there are better solutions but the one with the entrypoint.sh
seems to be good enough.
@thos-grol
Copy link

thos-grol commented Mar 6, 2025

I am getting this error too. But I haven't changed any code or anything. I'm not running on docker.

I even created a test.py file with bare minimum code with a single driver instance and I still get the same error? Did something change with selenium or the driver?


For reference, the script I wrote was multiprocessed selenium that scraped and worked fine for months, profiles were assigned based on the id given from the multiprocessing module.


I am using webdriver_manager. But I also used conda to create a new environment with selenium today. Either the new environment, the new webdriver, or the new selenium is the problem here.

@thos-grol
Copy link

thos-grol commented Mar 6, 2025

test code for reference after I tried a downloaded recent edgedriver to test.

from src.scraper.reader.Flows_Reader import Flows_Reader

d = webdriver.Edge(service=webdriver.EdgeService(executable_path='msedgedriver.exe'))

while True: pass
 C:\Files\Projects\manager>C:/Users/Andrew/anaconda3/python.exe c:/Files/Projects/manager/test.py
Traceback (most recent call last):
  File "c:\Files\Projects\manager\test.py", line 5, in <module>
    d = webdriver.Edge(service=webdriver.EdgeService(executable_path='msedgedriver.exe'))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Andrew\anaconda3\Lib\site-packages\selenium\webdriver\edge\webdriver.py", line 45, in __init__
    super().__init__(
  File "C:\Users\Andrew\anaconda3\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "C:\Users\Andrew\anaconda3\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in __init__
    self.start_session(capabilities)
  File "C:\Users\Andrew\anaconda3\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 342, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Andrew\anaconda3\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Andrew\anaconda3\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: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Stacktrace:
        GetHandleVerifier [0x00007FF781870AC5+13637]
        Microsoft::Applications::Events::EventProperty::empty [0x00007FF781AFBBB4+2078836]
        Microsoft::Applications::Events::EventProperty::empty [0x00007FF781A566B6+1401718]
        (No symbol) [0x00007FF78161A5DE]
        (No symbol) [0x00007FF781614C16]
        (No symbol) [0x00007FF781657D8D]
        (No symbol) [0x00007FF78164DA33]
        (No symbol) [0x00007FF7816232F4]
        (No symbol) [0x00007FF781622626]
        (No symbol) [0x00007FF781622EE1]
        (No symbol) [0x00007FF7816AE194]
        (No symbol) [0x00007FF78175607F]
        (No symbol) [0x00007FF7816B1B83]
        Microsoft::Applications::Events::EventProperty::to_string [0x00007FF781BB81A9+269801]
        Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF781807181+519345]
        Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF781802474+499620]
        Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF7818025B9+499945]
        Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF7817F7536+454758]
        BaseThreadInitThunk [0x00007FFA08F57374+20]
        RtlUserThreadStart [0x00007FFA097DCC91+33]

selenium version: 4.29.0
python: Python 3.12.7

@thos-grol
Copy link

Found a fix in another issue.

add "--edge-skip-compat-layer-relaunch" to options.

@cgoldberg
Copy link
Contributor

@thos-grol
When this occurred, were you running as Admin?

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

I'm running into the same issue. Just spun up a DigitalOcean droplet. Ran the following after server loaded (ubuntu 22.04.5 LTS)

sudo apt update
sudo apt -y upgrade
sudo apt install -y python3-pip
sudo apt install -y build-essential libssl-dev libffi-dev python3-dev
sudo apt install -y python3-venv
python3 -m venv my_env
source my_env/bin/activate

Installed the libraries from pip. Then ran the following.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager

def load_website(url):
    options = Options()
    options.add_argument("--headless=new") 
    options.add_argument("--disable-gpu")
    options.add_argument("--no-sandbox")
    
    service = Service()
    driver = webdriver.Chrome(service=service, options=options)
    
    try:
        driver.get(url)
        print("Page Title:", driver.title)
    finally:
        driver.quit()

if __name__ == "__main__":
    load_website("https://example.com")

Same with something simple.

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()

driver.get("https://www.selenium.dev/selenium/web/web-form.html")

title = driver.title

driver.implicitly_wait(0.5)

text_box = driver.find_element(by=By.NAME, value="my-text")
submit_button = driver.find_element(by=By.CSS_SELECTOR, value="button")

text_box.send_keys("Selenium")
submit_button.click()

message = driver.find_element(by=By.ID, value="message")
text = message.text

driver.quit()

Error

Traceback (most recent call last):
  File "/home/web/test2.py", line 4, in <module>
    driver = webdriver.Chrome()
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 250, in __init__
    self.start_session(capabilities)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 342, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.10/dist-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: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir

pip freeze

attrs==25.1.0
certifi==2025.1.31
charset-normalizer==3.4.1
exceptiongroup==1.2.2
h11==0.14.0
idna==3.10
outcome==1.3.0.post0
packaging==24.2
PySocks==1.7.1
python-dotenv==1.0.1
requests==2.32.3
selenium==4.29.0
sniffio==1.3.1
sortedcontainers==2.4.0
trio==0.29.0
trio-websocket==0.12.2
typing_extensions==4.12.2
urllib3==2.3.0
webdriver-manager==4.0.2
websocket-client==1.8.0
wsproto==1.2.0

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy

@cgoldberg
Copy link
Contributor

@niceguy4
What version of chrome and chromedriver?

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

@niceguy4 What version of chrome and chromedriver?

I didn't download chromedriver for this round of testing. I thought Selenium handles the download?

my /usr/bin/ directory does not have chrome or chromedriver

@cgoldberg
Copy link
Contributor

@niceguy4
It does. They should be in ~/.cache/selenium.

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

@cgoldberg
Inside the cache directory. These are the versions according to the folder names.

chrome 134.0.6998.35
chromedriver 134.0.6998.35

(my_env) root@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:~/.cache/selenium/chromedriver/linux64/134.0.6998.35# ./chromedriver --version
ChromeDriver 134.0.6998.35 (ea6ef4c2ac15ae95d2cfd65682da62c093415099-refs/branch-heads/6998@{#1472})

When I try to do ./chrome --version i get this. Not sure if it means anything.

(my_env) root@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:~/.cache/selenium/chrome/linux64/134.0.6998.35# ./chrome --version
./chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory

It looks like when I manually load the driver there is no issue but I'm not exactly sure what I'm doing, lol.

(my_env) root@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:~/.cache/selenium/chromedriver/linux64/134.0.6998.35# ./chromedriver 
Starting ChromeDriver 134.0.6998.35 (ea6ef4c2ac15ae95d2cfd65682da62c093415099-refs/branch-heads/6998@{#1472}) on port 0
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 43491.

Ran this for the missing chrome item.
sudo apt install libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2

I now get this when I do ./chrome --version

(my_env) root@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:~/.cache/selenium/chrome/linux64/134.0.6998.35# ./chrome --version
Google Chrome for Testing 134.0.6998.35

@cgoldberg
Copy link
Contributor

@niceguy4
Try starting chrome from the command line. It may complain you need the --no-sandbox arg.

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

@cgoldberg

(my_env) root@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:~/.cache/selenium/chrome/linux64/134.0.6998.35# ./chrome
[33777:33777:0306/044449.185480:ERROR:zygote_host_impl_linux.cc(105)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
(my_env) root@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:~/.cache/selenium/chrome/linux64/134.0.6998.35# ./chrome --no-sandbox
[33784:33784:0306/044500.040847:ERROR:ozone_platform_x11.cc(245)] Missing X server or $DISPLAY
[33784:33784:0306/044500.041124:ERROR:env.cc(257)] The platform failed to initialize.  Exiting.

@cgoldberg
Copy link
Contributor

@niceguy4 actually... I see you are running as root... so chrome is going to fail, and that is the cause of this issue. See my comment earlier in this thread where I showed that was happening.

I would recommend not running as root to get around this.

@cgoldberg
Copy link
Contributor

@niceguy4
OK... your issue is there is no display, so try passing the --headless=new arg. It will likely still fail though.

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

@cgoldberg Interesting. Love root and accidentally deleting my server sometimes :)

Here's with a user instead of root.

niceguy1@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:~/.cache/selenium/chrome/linux64/134.0.6998.35$ ./chrome --headless=new --no-sandbox
[34256:34269:0306/045427.150904:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34269:0306/045427.151204:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34269:0306/045427.151342:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34269:0306/045427.151427:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34269:0306/045427.161587:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34269:0306/045427.243827:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34269:0306/045427.359433:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34256:0306/045427.550332:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34256:34256:0306/045427.562375:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34256:34269:0306/045427.562698:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34269:0306/045427.562908:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34256:34256:0306/045427.564925:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34256:34256:0306/045427.594716:ERROR:global_accelerator_listener_linux.cc(350)] Failed to connect to signal: org.freedesktop.portal.GlobalShortcuts.Activated
[34256:34332:0306/045427.652749:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[34256:34332:0306/045427.653406:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[34256:34332:0306/045427.653958:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[34256:34256:0306/045427.661510:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34256:34256:0306/045427.666914:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34256:34271:0306/045430.909754:ERROR:registration_request.cc(291)] Registration response error message: DEPRECATED_ENDPOINT
[34256:34256:0306/045431.595717:ERROR:fm_registration_token_uploader.cc(183)] Client is missing for kUser scope
[34256:34256:0306/045431.600921:ERROR:fm_registration_token_uploader.cc(183)] Client is missing for kUser scope
niceguy1@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:~/.cache/selenium/chrome/linux64/134.0.6998.35$ ./chrome --headless=new --no-sandbox --disable-dev-shm-usage --disable-gpu
[34360:34373:0306/045631.417182:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34373:0306/045631.417499:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34373:0306/045631.417612:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34373:0306/045631.417711:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34373:0306/045631.427358:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34373:0306/045631.509493:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34373:0306/045631.630646:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34360:0306/045631.853146:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34360:34360:0306/045631.862934:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34360:34373:0306/045631.864383:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34373:0306/045631.864618:ERROR:bus.cc(408)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[34360:34360:0306/045631.866744:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34360:34360:0306/045631.881885:ERROR:global_accelerator_listener_linux.cc(350)] Failed to connect to signal: org.freedesktop.portal.GlobalShortcuts.Activated
[34360:34445:0306/045631.978104:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[34360:34445:0306/045631.978728:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[34360:34445:0306/045631.979166:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[34360:34360:0306/045631.984434:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34360:34360:0306/045631.993222:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
[34360:34375:0306/045635.201773:ERROR:registration_request.cc(291)] Registration response error message: DEPRECATED_ENDPOINT
[34360:34360:0306/045636.061241:ERROR:fm_registration_token_uploader.cc(183)] Client is missing for kUser scope
[34360:34360:0306/045636.222609:ERROR:fm_registration_token_uploader.cc(183)] Client is missing for kUser scope
[34360:34375:0306/045703.693656:ERROR:registration_request.cc(291)] Registration response error message: DEPRECATED_ENDPOINT
[34360:34375:0306/045801.867020:ERROR:registration_request.cc(291)] Registration response error message: DEPRECATED_ENDPOINT
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:106)
[34360:34375:0306/045929.858539:ERROR:registration_request.cc(291)] Registration response error message: DEPRECATED_ENDPOINT
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:106)

[34463:34463:0306/045931.553929:ERROR:gpu_blocklist.cc(82)] Unable to get gpu adapter
[34360:34360:0306/045931.554402:ERROR:service_client.cc(36)] Unexpected on_device_model service disconnect: The device's GPU is not supported.

@cgoldberg
Copy link
Contributor

cgoldberg commented Mar 6, 2025

@niceguy4
I have no idea what those error messages mean. Did chrome actually start? Do you see it running if you do: ps -aux | grep chrome?

p.s. don't run as root, like ever. Use sudo if you need temporary privileges :)

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

@cgoldberg Shit. It works now and I have no idea why it works.

"It", being this script.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager

def load_website(url):
    options = Options()
    options.add_argument("--headless=new")  # Run in headless mode (no GUI)
    options.add_argument("--disable-gpu")
    options.add_argument("--no-sandbox")
    
    service = Service()
    driver = webdriver.Chrome(service=service, options=options)
    
    try:
        driver.get(url)
        print("Page Title:", driver.title)
    finally:
        driver.quit()

if __name__ == "__main__":
    load_website("https://example.com")

Would it be helpful to spin up another Digitalocean box and see if the issue is running python as root?

Also, I did run this a couple comments up so it might be related to this command below.
sudo apt install libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

I'd run ps -aux | grep chrome but you'll be disappointed in the output....

(my_env) root@ubuntu-s-1vcpu-2gb-nyc3-01-crawler:/home/web# ps -aux | grep chrome
root       34694  0.0  0.1   7008  2264 pts/0    S+   05:07   0:00 grep --color=auto chrome

root :)

@cgoldberg
Copy link
Contributor

@niceguy4
It probably works because you aren't running as root... which has already been identified as the cause of this issue.

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

@caborabo thank you for your help. Really sorry for wasting your time.

@niceguy4
Copy link

niceguy4 commented Mar 6, 2025

@cgoldberg I spun up another ubuntu DO droplet. It appears that this item below "fixed" the issue. I ran everything as root user, too but will not run as root going forward :)

sudo apt install libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2

My full steps for the DO ubuntu server.

sudo apt update
sudo apt -y upgrade
sudo apt install -y python3-pip
sudo apt install -y python3-venv
sudo apt install -y build-essential libssl-dev libffi-dev python3-dev
sudo apt install libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2
python3 -m venv my_env
source my_env/bin/activate

For this code...

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager

def load_website(url):
    options = Options()
    options.add_argument("--headless=new")  # Run in headless mode (no GUI)
    options.add_argument("--disable-gpu")
    options.add_argument("--no-sandbox")
    
    service = Service()
    driver = webdriver.Chrome(service=service, options=options)
    
    try:
        driver.get(url)
        print("Page Title:", driver.title)
    finally:
        driver.quit()

if __name__ == "__main__":
    load_website("https://example.com")

No issues.

(my_env) root@ubuntu-s-1vcpu-2gb-nyc1-01-test:/home/web# python test.py
Page Title: Example Domain

edit: this is only true for ubuntu 22.04. Steps above work for ubuntu 22.04.

None of the steps above worked for ubuntu 24.10, running as non-root user and installing the apts listed above. Still have the same issue for ubuntu 24.10

edit3: I'm going nuts, my brain is melting. It appears that sudo apt install libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2t64 fixed the issue for ubuntu 24.10, i changed libasound2 to libasound2t64.

@cgoldberg
Copy link
Contributor

@niceguy4
That's good to know... but that's purely a Chrome dependency issue and not something Selenium developers can fix.

@VietND96
Copy link
Member

VietND96 commented Mar 6, 2025

@niceguy4, I saw your comment mentioned the issue when you ran test in the container, and fix by installing missing deps via apt install. I am not sure the browser pre-configure, but looks like you are using chrome-linux64.zip from chrome-for-testing, in package there is a file deb.deps with mention all deps needed for chrome can be launched, I think you can refer to that to keep container env install enough deps.

@ssada1975
Copy link

Same issue but it occurred when upgrading from 131 to upper version With the same parameters to launch cromedriver.
Isn't there any way to check what changed between 131 And 132 for example in chrome driver to find the solution ?

@cgoldberg
Copy link
Contributor

cgoldberg commented Mar 6, 2025

Isn't there any way to check what changed between 131 And 132 for example in chrome driver to find the solution ?

@ssada1975

You'll have to take that up with chrome/chromedriver maintainers.

@thos-grol
Copy link

thos-grol commented Mar 6, 2025

@thos-grol When this occurred, were you running as Admin?

I was using admin. But with that option it now works even though I am using it.
In my past runs I was also using it too, so whatever change the edge driver creators made broke stuff.

@niceguy4
Copy link

niceguy4 commented Mar 7, 2025

@niceguy4, I saw your comment mentioned the issue when you ran test in the container, and fix by installing missing deps via apt install. I am not sure the browser pre-configure, but looks like you are using chrome-linux64.zip from chrome-for-testing, in package there is a file deb.deps with mention all deps needed for chrome can be launched, I think you can refer to that to keep container env install enough deps.

@VietND96 Thank you!

@medsagou
Copy link

medsagou commented Mar 8, 2025

If you are using ubuntu bash, u have to run this commend before runing a selenium program
sudo apt install -y libxss1 libappindicator3-1 libindicator7
and add the folwoing arguments if you are using and ubuntu rdp:
options.add_argument("--no-sandbox") options.add_argument("--disable-dev-shm-usage")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests