Skip to content

selenium.common.exceptions.SessionNotCreatedException in headless mode #2483

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

Closed
erdaldogan opened this issue Feb 11, 2024 · 2 comments
Closed
Labels
duplicate The answer/solution already exists somewhere self-resolved You closed/solved the issue on your own UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode

Comments

@erdaldogan
Copy link

erdaldogan commented Feb 11, 2024

It is now solved, very was similar to #2247. It was due to proxy and headless mode. setting headless2=True fixed the problem.

Hi, I'm getting the following exception when I run the seleniumbase (4.23.2) script (at the bottom) in ubuntu and headless mode. Same script works like a charm at macOS.

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x5592aceb1d93 <unknown>
#1 0x5592acb95337 <unknown>
#2 0x5592acbc9bc0 <unknown>
#3 0x5592acbc5765 <unknown>
#4 0x5592acc0fb7c <unknown>
#5 0x5592acc031e3 <unknown>
#6 0x5592acbd3135 <unknown>
#7 0x5592acbd413e <unknown>
#8 0x5592ace75e4b <unknown>
#9 0x5592ace79dfa <unknown>
#10 0x5592ace626d5 <unknown>
#11 0x5592ace7aa6f <unknown>
#12 0x5592ace4669f <unknown>
#13 0x5592ace9f098 <unknown>
#14 0x5592ace9f262 <unknown>
#15 0x5592aceb0f34 <unknown>
#16 0x7f4ae4494ac3 <unknown>

I confirmed google-chrome is on my path. When I run the google-chrome --headless on terminal, I will get the following

[0211/101049.036384:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[0211/101049.134614:WARNING:sandbox_linux.cc(418)] InitializeSandbox() called with multiple threads in process gpu-process.
[0211/101049.147279:ERROR:command_buffer_proxy_impl.cc(131)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

however, when run $ google-chrome --headless --disable-gpu, error will disappear

$ google-chrome --headless --disable-gpu
[0211/101614.046994:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.

I couldn't find a way to pass --disable-gpu option to SB context manager.

Currently I'm on ubuntu 22.04 and google-chrome-stable (121.0.6167.160-1). seleniumbase will install
*** chromedriver to download = 121.0.6167.85 (Latest Stable)
in first run.

my selenium script: (in fact, your turnstile example)

with SB(uc=True, headless=True, proxy="SOMEPROXY") as sb:
        open_the_turnstile_page(sb)
        try:
            click_turnstile_and_verify(sb)
        except Exception as exc:
            logger.error(f"An exception is caught! {exc}")
            open_the_turnstile_page(sb)
            click_turnstile_and_verify(sb)

UPDATE: Might be related

@mdmintz mdmintz added duplicate The answer/solution already exists somewhere self-resolved You closed/solved the issue on your own UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode labels Feb 11, 2024
@mdmintz
Copy link
Member

mdmintz commented Feb 11, 2024

Duplicate of #2426 (reply in thread)

(Also looks like you already figured it out, based on your edits.)

@mdmintz mdmintz closed this as completed Feb 11, 2024
@erdaldogan
Copy link
Author

For future reference, I'd say it is duplicate of #2247 instead of #2246. It was about using proxy and headless at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate The answer/solution already exists somewhere self-resolved You closed/solved the issue on your own UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode
Projects
None yet
Development

No branches or pull requests

2 participants