SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.8k stars 8.21k forks source link

[🐛 Bug]: SessionNotCreatedException on GitHub Actions on Ubuntu 24.04 #14609

Open madebr opened 1 month ago

madebr commented 1 month ago

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//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

github-actions[bot] commented 1 month ago

@madebr, 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!

VietND96 commented 3 days ago

What if option --headless=new ?

madebr commented 3 days ago

I bumped the emscripten job to ubuntu-24.04 and selenium fails to "obtain a working Selenium Manager binary".

Unable to obtain working Selenium Manager binary https://github.com/madebr/SDL/actions/runs/11935153665/job/33265980644#step:25:46 ``` 2: Traceback (most recent call last): 2: File "/usr/lib/python3/dist-packages/selenium/webdriver/common/driver_finder.py", line 38, in get_path 2: path = SeleniumManager().driver_location(options) if path is None else path 2: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2: File "/usr/lib/python3/dist-packages/selenium/webdriver/common/selenium_manager.py", line 89, in driver_location 2: args = [str(self.get_binary()), "--browser", browser] 2: ^^^^^^^^^^^^^^^^^ 2: File "/usr/lib/python3/dist-packages/selenium/webdriver/common/selenium_manager.py", line 73, in get_binary 2: raise WebDriverException(f"Unable to obtain working Selenium Manager binary; {path}") 2: selenium.common.exceptions.WebDriverException: Message: Unable to obtain working Selenium Manager binary; /usr/lib/python3/dist-packages/selenium/webdriver/common/linux/selenium-manager 2: 2: 2: The above exception was the direct cause of the following exception: 2: 2: Traceback (most recent call last): 2: File "/home/runner/work/SDL/SDL/test/emscripten/driver.py", line 183, in 2: raise SystemExit(main()) 2: ^^^^^^ 2: File "/home/runner/work/SDL/SDL/test/emscripten/driver.py", line 160, in main 2: sdl_test_driver = SDLSeleniumTestDriver( 2: ^^^^^^^^^^^^^^^^^^^^^^ 2: File "/home/runner/work/SDL/SDL/test/emscripten/driver.py", line 56, in __init__ 2: self.driver = driver_contructor(options=driver_options) 2: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2: File "/usr/lib/python3/dist-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__ 2: super().__init__( 2: File "/usr/lib/python3/dist-packages/selenium/webdriver/chromium/webdriver.py", line 49, in __init__ 2: self.service.path = DriverFinder.get_path(self.service, options) 2: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2: File "/usr/lib/python3/dist-packages/selenium/webdriver/common/driver_finder.py", line 41, in get_path 2: raise NoSuchDriverException(msg) from err 2: selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome using Selenium Manager.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location 2: ```

I'm using python3-selenium from Ubuntu's apt-get.