Selenium failing to launch in Proxmox container

I’m having trouble getting Selenium to work in headless mode on my Proxmox server. Here’s what I’ve done:

  • Set up a Proxmox container with Ubuntu 24.10
  • Created a Python venv and installed Selenium and Chrome
  • Wrote a test script to run Selenium in headless mode

When I run the script, I get this error:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: DevToolsActivePort file doesn't exist

I tried adding --remote-debugging-port=9222 to the Chrome options, but then I get:

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

I’m not sure what I’m doing wrong. Has anyone encountered this issue before? Any ideas on how to fix it?

I encountered a similar issue when running Selenium in a Proxmox container. The problem often stems from container limitations. To resolve it, I had to install additional dependencies. Try running ‘apt-get install -y xvfb libxi6 libgconf-2-4’ in your container. Then, use pyvirtualdisplay to create a virtual display before initializing your webdriver. This approach bypassed the graphical environment requirements and allowed Selenium to function properly in headless mode. If you’re still facing issues, consider using a full VM instead of a container for more consistent behavior with browser automation tools.

hey pete, had similar issues. try adding --no-sandbox to ur chrome options. also, make sure u got the right chromedriver version for ur chrome. if that don’t work, maybe try firefox instead? it’s usually less fussy in containers. good luck!

I’ve dealt with this headache before in Proxmox containers. The issue often boils down to missing system libraries. Here’s what worked for me:

First, make sure you’ve got all the necessary dependencies installed. Run ‘apt-get update && apt-get install -y wget unzip libglib2.0-0 libnss3 libgconf-2-4 libfontconfig1’ in your container.

Next, double-check you’re using a compatible version of Chrome and chromedriver. They need to match exactly.

If you’re still hitting walls, try setting up a virtual framebuffer. Install xvfb with ‘apt-get install xvfb’, then run your script with ‘xvfb-run python your_script.py’.

Lastly, if none of that works, you might need to tweak your container’s configuration. Make sure it has enough resources allocated and that the necessary kernel modules are loaded on the host.

Persistence is key with these container quirks. Keep at it, and you’ll crack it eventually!