selenium: [🐛 Bug]: SessionNotCreatedException on GitHub Actions on Ubuntu 24.04

What happened?

We (=the libsdl-org/SDL project) are using Selenium to run the emscripten tests in ci. When bumping the os from ubuntu-22.04 to ubuntu-24.04, all tests fail.

Link to a “good log”. Link to a “bad log”

How can we reproduce the issue?

This only reproduces on GitHub Actions.


# Clone SDL repo locally
cd /tmp
git clone https://github.com/madebr/SDL
cd SDL
git checkout emscripten-selenium-ubuntu-24-04

# Create new GitHub repo
gh repo create --public <your-user>/SDL-test

# Add the just-created GitHub repo as a new remote
git remote add origin git@github.com:<your-user>/SDL-test

# Push SDL to your new GitHub repo
git push --set-upstream origin emscripten-selenium-ubuntu-24-04:refs/heads/emscripten-selenium-ubuntu-24-04

Visit https://github.com/<your-user>/SDL-test/actions in your browser to see the output.

Relevant log output

1: Traceback (most recent call last):
1:   File "/home/runner/work/SDL/SDL/test/emscripten/driver.py", line 183, in <module>
1:     raise SystemExit(main())
1:                      ^^^^^^
1:   File "/home/runner/work/SDL/SDL/test/emscripten/driver.py", line 160, in main
1:     sdl_test_driver = SDLSeleniumTestDriver(
1:                       ^^^^^^^^^^^^^^^^^^^^^^
1:   File "/home/runner/work/SDL/SDL/test/emscripten/driver.py", line 56, in __init__
1:     self.driver = driver_contructor(options=driver_options)
1:                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1:   File "/home/runner/.local/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
1:     super().__init__(
1:   File "/home/runner/.local/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
1:     super().__init__(command_executor=executor, options=options)
1:   File "/home/runner/.local/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 212, in __init__
1:     self.start_session(capabilities)
1:   File "/home/runner/.local/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 299, in start_session
1:     response = self.execute(Command.NEW_SESSION, caps)["value"]
1:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1:   File "/home/runner/.local/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
1:     self.error_handler.check_response(response)
1:   File "/home/runner/.local/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
1:     raise exception_class(message, screen, stacktrace)
1: selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
1:   (session not created: DevToolsActivePort file doesn't exist)
1:   (The process started from chrome location /opt/hostedtoolcache/setup-chrome/chromium/1369611/x64/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
1: Stacktrace:
1: #0 0x5646e1b69cd2 <unknown>
1: #1 0x5646e1b5ba5e <unknown>
1: #2 0x5646e1607f27 <unknown>
1: #3 0x5646e163dda4 <unknown>
1: #4 0x5646e16381a6 <unknown>
1: #5 0x5646e168335d <unknown>
1: #6 0x5646e1682ad6 <unknown>
1: #7 0x5646e1675fe3 <unknown>
1: #8 0x5646e1645c41 <unknown>
1: #9 0x5646e1644d39 <unknown>
1: #10 0x5646e1645a1c <unknown>
1: #11 0x5646e1b1729f <unknown>
1: #12 0x5646e1b323d3 <unknown>
1: #13 0x5646e1b31e3b <unknown>
1: #14 0x5646e1b32845 <unknown>
1: #15 0x5646e1b21ab3 <unknown>
1: #16 0x5646e1b32be0 <unknown>
1: #17 0x5646e1b07ee1 <unknown>
1: #18 0x5646e1b4c248 <unknown>
1: #19 0x5646e1b4c3d9 <unknown>
1: #20 0x5646e1b5ad65 <unknown>
1: #21 0x7f01d389ca94 <unknown>
1: #22 0x7f01d3929c3c <unknown>

Operating System

Ubuntu 24.04

Selenium version

Python, 4.25.0

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

Chrome 132.0.6781.0

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

ChromeDrive 132.0.6781.0

Are you using Selenium Grid?

n/a

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Recently, GitHub updated ubuntu-latest from 22.04 to 24.04. In this update, it looks like Chrome/Edge didn’t wrap with --no-sandbox by default anymore. Which causes the error

selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don’t use --user-data-dir

Refer to an explanation https://stackoverflow.com/questions/70385737/selenium-common-exceptions-invalidargumentexception-message-invalid-argument

Update ChromeOptions/EdgeOptions always append argument --no-sandbox when creating WebDriver looks like a solution till now. An update to prove it works can be referred to https://github.com/SeleniumHQ/seleniumhq.github.io/pull/2139

Yup, that makes ci complete!

Thank you very much for the help! I’m leaving the honors of closing this issue to you 😃

There are similar issues to this, and they are related to the use of a custom Python package manager. For example:

https://github.com/SeleniumHQ/selenium/issues/14488

See this comment:

https://github.com/SeleniumHQ/selenium/issues/14488#issuecomment-2344274646