r/SeleniumPython • • Mar 30 '25

selenium don't run on proxmox container

Hello everyone, I need some help because I'm trying to run selenium in headless mode on my proxmox server but it's not working. Here are the specifics:

- i set up a proxmox container with ubuntu-24.10-standard_24.10-1_amd64.tar.zst

- i created inside a venv for python, installed selenium and the necessary packages and chrome.

- I created a test_selenium.py script like this:

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

# Set up Chrome options
chrome_options = Options()
chrome_options.add_argument("--headless=new")  # use new headless mode if available
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("window-size=1920x1080")

# Install Chromedriver and initialize the service
driver_path = ChromeDriverManager().install()
print(f"Chromedriver path: {driver_path}")
service = Service(driver_path)

# Create the webdriver instance
driver = webdriver.Chrome(service=service, options=chrome_options)

# Navigate to a webpage
driver.get("https://www.example.com")
print("Page Title:", driver.title)

# Close the browser
driver.quit()

Now when I run the script I obtain:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: DevToolsActivePort file doesn't exist
Stacktrace:
#0 0x6395a5333ffa <unknown>
#1 0x6395a4df2970 <unknown>
#2 0x6395a4e318e8 <unknown>
#3 0x6395a4e2cdca <unknown>
#4 0x6395a4e2818f <unknown>
#5 0x6395a4e78bd9 <unknown>
#6 0x6395a4e78106 <unknown>
#7 0x6395a4e6a063 <unknown>
...#19 0x7565c6b33a4c <unknown>

Then I added to the code:

chrome_options.add_argument("--remote-debugging-port=9222")

And I obtain the error:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created from chrome not reachable

What am I doing wrong? can someone help me?

2 Upvotes

3 comments sorted by

1

u/ReMiiind Mar 30 '25

Did you check any LLMs?

1

u/gatomato92 Mar 30 '25

Sorry what is LLMs? How to check?

1

u/Floryda_Guennoc 4d ago

usually that DevToolsActivePort error means the browser binary is crashing immediately on launch because of missing shared libraries. try running the browser binary directly from the command line with those same flags to see the actual crash output