11/21/2022, 12:31 PM
Hi! Has anyone have tried running Selenium on Orchest pipeline before? Now, I have tried it with both Firefox and Chrome drivers, but both of them doesn't work. For example, with Chrome drivers, I am getting this error:
Copy code
unknown error: DevToolsActivePort file doesn't exist
Simple Google search would lead to this thread. Top answer says that Selenium web drivers should be initialized as regular user instead of root user. So, I thought maybe I could retake ownership with this command line:
Copy code
sudo chown -R $(whoami):$(whoami) ~/
Unfortunately, it doesn't help. Maybe you have any other ideas how I could initialize Selenium as a regular user? In comments section I am attaching both environment and python code I am using.
Copy code
sudo apt update -y

sudo apt-get install -y libglib2.0 libnss3 libgconf-2-4 libfontconfig1
sudo apt-get install -y chromium-browser

pip install -U selenium
pip install webdriver-manager
Copy code
from selenium import webdriver
from import Options
from import Service
from import ChromeDriverManager

options = Options()
options.add_argument("--disable-extensions") # disabling extensions
options.add_argument("--disable-dev-shm-usage") # overcome limited resource problems
options.add_argument("--no-sandbox") # Bypass OS security model
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)

Rick Lamers

11/21/2022, 12:34 PM
Hi @ekeras, I helped a friend set up selenium on Orchest a while ago. I'll share with you a minimal example of how to get it to work 👍 Give me some time to find it & clean it up.
orchest 1 The essential bit is regarding how to install a chromium based browser inside a container context, and the most foolproof method there is using the Chrome debian package. Environment setup script:
Copy code

# Install any dependencies you have in this shell script,
# see <>

# E.g. mamba install -y tensorflow
sudo apt update
cd /tmp
wget <>
sudo apt install ./google-chrome-stable_current_amd64.deb -y

pip install selenium webdriver-manager
You should be able to import that project and it should just work™


11/21/2022, 3:37 PM
Thanks! That works nicely
👍 1