如何在 Raspberry PI 4 上运行 selenium+chrome? [英] How to run selenium+chrome on Raspberry PI 4?

查看:55
本文介绍了如何在 Raspberry PI 4 上运行 selenium+chrome?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个全新的开箱即用的 Raspberry Pi 4,我想在它上面运行 python selenium.但是,我没有用于此命令的路径:有什么提示吗?

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")

如果有人有这方面的途径,我也很乐意用 Firefox 运行它!

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

谢谢,/yga

推荐答案

啊哈 - 看起来像 https://ivanderevianko.com/2020/01/selenium-chromedriver-for-raspberrypi 有答案!

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

sudo apt-get install chromium-chromedriver

然后在python代码中:

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')

(我想运行一个无头版本;因此是 pyvirtualdisplay)

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

这篇关于如何在 Raspberry PI 4 上运行 selenium+chrome?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆