I have a service deployed on DigitalOcean that uses Selenium Standalone in a Docker container. Currently, the service creates browser sessions without any profiles and works fine.
However, I want when my serice connects to the Selenium Standalone (RemoteWebDriver) to use the same Chrome profile that I use when I log in via xRDP on the DigitalOcean droplet.
What I Have Tried
Matching Chrome & ChromeDriver Versions. Since mismatched versions can cause issues, I ensured that xRDP Chrome and Selenium ChromeDriver versions are identical
Mounting xRDP Chrome Profile into Selenium. I identified the default Chrome profile path on my xRDP session: /home/user/.config/google-chrome Then, I mounted it inside the Selenium Standalone container by adding this volume in my deployment YAML file: -v /home/user/.config/google-chrome:/home/seluser/.config/google-chrome:rw Additionally, I set Chrome options to use the profile: options.AddArgument("--user-data-dir=/home/seluser/.config/google-chrome"); options.AddArgument("--profile-directory=Default"); To avoid permission issues, I changed ownership of the profile directory: sudo chown -R 1200:1201 /home/user/.config/google-chrome
Increasing Shared Memory Size. Since Chrome can crash due to limited /dev/shm, I added these changes: Increased shared memory: --shm-size=4g Disabled default /dev/shm usage: options.AddArgument("--disable-dev-shm-usage");
The Issue
After making these changes, my service fails to start a Selenium session. The logs show:
Could not start a new session. Error while creating session with the driver service.
Stopping driver service: Could not start a new session. Response code 500.
Message: session not created: Chrome failed to start: exited normally.
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
I already don't know what else to do, Chat GPT suggests all the same solutions: check versions, check permissions, increase shm size - but I already did it and still facing this issue. I would be really happy if anyone knows how to fix it or maybe has some suggestions that possibly can help