How to run selenium+chrome on Raspberry PI 4?

Viewed 13309

I have a brand-new out of the box Raspberry Pi 4 that I'd like to run python selenium on. However, I don't have the path to use for this command: any tips?

driver = webdriver.Chrome("path-to-chromiumdriver")

I am also happy to run it with Firefox if someone has the path for that!

Thanks, /yga

1 Answers

Aha - looks like https://ivanderevianko.com/2020/01/selenium-chromedriver-for-raspberrypi has the answer!

sudo apt-get install chromium-chromedriver

And then in the python code:

from pyvirtualdisplay import Display

display = Display(visible=0, size=(1600, 1200))
display.start()
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')

(I wanted to run a headless version; hence the pyvirtualdisplay)

Related