screenshot - raspberry pi

88 views
Skip to first unread message

stijn goossens

unread,
Sep 9, 2019, 11:44:41 PM9/9/19
to Selenium Users
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




Jim Evans

unread,
Sep 10, 2019, 6:03:10 AM9/10/19
to Selenium Users
I believe, though I could be mistaken, that the normal releases of gechodriver for Linux are compiled for x86/x64 Intel architecture. That means those binaries won’t just run on an ARM architecture like the Raspberry Pi. The text of the traceback shows that the session isn’t being created, and the error message (“invalid format”) would seem to support that. You’ll need a version of geckodriver compiled for the processor architecture, and there’s every chance that means you’ll need to build geckodriver ( which is developed in Rust) yourself.
Reply all
Reply to author
Forward
0 new messages