I am trying to scrape a website using Selenium but I am having some issues either with Chromium or the path to the chromedriver. I am a beginner with Selenium but can't seem to find the solution.
I am working on WSL with Ubuntu in a local pyenv. So I have moved both the Linux and Windows chromedriver to
driver_path_windows = "/home/leah/.pyenv/versions/3.10.6/envs/vinted-api/bin/chromedriver.exe"
driver_path_linux = "/home/leah/.pyenv/versions/3.10.6/envs/vinted-api/bin/chromedriver"
And have tried both
service = Service(driver_path_windows)
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
AND
service = Service(driver_path_linux)
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
Neither of these work, and I get this error message "message": "Message: unknown error: Chrome failed to start: exited abnormally.\n (unknown error: DevToolsActivePort file doesn't exist)\n (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.
I have also tried with paths in both my desktop for the .exe or just in a standard WSL directory and I get the same error, which makes me think that there is an error with chromium.
When I run snap install chromium
I get this error:
✗ chromium-browser --version
Command '/usr/bin/chromium-browser' requires the chromium snap to be installed.
Please install it with:
snap install chromium
✗ snap install chromium
error: cannot communicate with server: Post http://localhost/v2/snaps/chromium: dial unix /run/snapd.socket: connect: no such file or directory
And this is the output for snap version
snap 2.54.3+20.04.1ubuntu0.2
snapd unavailable
series -
But I don't have any error entry logs
journalctl -u snapd
No journal files were found.
-- No entries --
I can run sudo apt install chromium-browser
Reading package lists... Done
Building dependency tree
Reading state information... Done
chromium-browser is already the newest version (1:85.0.4183.83-0ubuntu0.20.04.3).
0 upgraded, 0 newly installed, 0 to remove and 245 not upgraded.
But not sudo snap install chromium
error: cannot communicate with server: Post http://localhost/v2/snaps/chromium: dial unix /run/snapd.socket: connect: no such file or directory
I have also tried to download the official Ubuntu version for Chrome, based on this solution (option 1), Unable to install chromium using snap on WSL
But I am not sure how to get Chrome to run from the WSL