Skip to content

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

Closed
@erdaldogan

Description

@erdaldogan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeduplicateThe answer/solution already exists somewhereself-resolvedYou closed/solved the issue on your own

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions