ekeras
11/21/2022, 12:31 PMunknown 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:
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.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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
options = Options()
options.add_argument("--headless")
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)
driver.get("<https://www.google.com>")
Rick Lamers
#!/bin/bash
# Install any dependencies you have in this shell script,
# see <https://docs.orchest.io/en/latest/fundamentals/environments.html#install-packages>
# E.g. mamba install -y tensorflow
sudo apt update
cd /tmp
wget <https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb>
sudo apt install ./google-chrome-stable_current_amd64.deb -y
pip install selenium webdriver-manager
ekeras
11/21/2022, 3:37 PM