Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run selenium+chrome on Raspberry PI 4?

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

like image 428
10 revs, 7 users 53% Avatar asked Nov 24 '20 01:11

10 revs, 7 users 53%


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)

like image 59
10 revs, 7 users 53% Avatar answered Oct 08 '22 20:10

10 revs, 7 users 53%