Dear Selenium users
I'm trying to take a screenshot from a website from my raspberry pi (running hassbian), doesn't have any X-environment installed on it.
The code I'm running runs fine on another debian buster based system (crunchbang++) but not on the raspberry.
python script I try to run: screenshot.py:
from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install(),options=options)
driver.get('https://python.org')
driver.save_screenshot("screenshot.png")
driver.close()
Error message:
pi@hassbian:/home/homeassistant/.homeassistant/python_scripts $ python3 screenshot.py
Checking for linux32 geckodriver:v0.24.0 in cache
Driver found in /home/pi/.wdm/geckodriver/v0.24.0/linux32/geckodriver
screenshot.py:8: DeprecationWarning: use options instead of firefox_options
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install(),firefox_options=options)
Traceback (most recent call last):
File "screenshot.py", line 8, in <module>
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install(),firefox_options=options)
File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/pi/.wdm/geckodriver/v0.24.0/linux32/geckodriver'
Could any advice be given if I'm trying to do something impossible or if there would be a straighforward workaround?
Thanks in advance!
properties of the system:
pi@hassbian:/home/homeassistant/.homeassistant/python_scripts $ hostnamectl
Static hostname: hassbian
Icon name: computer
Machine ID: **
Boot ID: **
Operating System: Raspbian GNU/Linux 10 (buster)
Kernel: Linux 4.19.66-v7+
Architecture: arm
pi@hassbian:/home/homeassistant/.homeassistant/python_scripts $ firefox -v
Mozilla Firefox 60.9.0
pi@hassbian:/home/homeassistant/.homeassistant/python_scripts $ python3 --version
Python 3.7.3
>>> import selenium
>>> print(selenium.__version__)
3.141.0