I have a raspberry-pi running linux-server as platform. Therefore there is no GUI and I execute all my tasks through terminal by SSH-ing into the Pi. Platform details:
uname -a
>> Linux ubuntu 5.4.0-1080-raspi #91-Ubuntu SMP PREEMPT Thu Jan 19 09:35:03 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
Chromium [No issues here]
I have installed Chromium through snap.
chromium --version
>> Chromium 109.0.5414.119 snap
I am able to run chromium, navigate to a website, and take a snapshot
chromium --headless --disable-gpu --screenshot https://www.wikipedia.com
>> 0215/140750.965255:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[0215/140752.998408:WARNING:sandbox_linux.cc(385)] InitializeSandbox() called with multiple threads in process gpu-process.
[0215/140802.665622:INFO:headless_shell.cc(223)] 84646 bytes written to file screenshot.png
Chromedriver [Issues]
I downloaded chromedriver this way
wget https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip
And moved Chromedriver to the applications folder after unzipping
I get this error when trying to get chromedriver version, let alone run it
chromedriver --version
>> bash: /usr/local/bin/chromedriver: cannot execute binary file: Exec format error
My Python Script [Issues]
Here is the script I want to be able to run finally
import selenium
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--disable-gpu")
driver = webdriver.Chrome(options=options)
driver.get("https://www.wikipedia.com")
driver.save_screenshot("proof.png")
This is the error I get when I try to run it
python3 test.py
>> OSError: [Errno 8] Exec format error: 'chromedriver'
What I've Tried already
Using chromedriver directly through ChromeDriverManager
import selenium
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--disable-gpu")
driver = webdriver.Chrome(service=Service(ChromeDriverManager(path=".", chrome_type=ChromeType.CHROMIUM).install()), options=options)
driver.get("https://www.wikipedia.com")
driver.save_screenshot("proof.png")
The error
OSError: [Errno 8] Exec format error: './.wdm/drivers/chromedriver/linux64/109.0.5414/chromedriver'
Checking file permissions
Made sure file has execute permissions
ls -l /usr/local/bin/chromedriver
>> -rwxr-xr-x 1 ubuntu ubuntu 20427216 Sep 8 2021 /usr/local/bin/chromedriver