安装Chromium浏览器命令:
sudo apt-get install chromium-browser
安装Selenium命令:
pip3 install selenium
从launchpad.net下载Chromium浏览器专用的WebDriver,由于树莓派是用ARM的CPU,下载时要选择armhf (Updates)的版本。#下载Chromium浏览器WebDriver
wget http://launchpadlibrarian.net/361669488/chromium-chromedriver_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb
安装Chromium浏览器WebDriver
sudo dpkg -i chromium-chromedriver_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb
代码测试:
from selenium import webdriver
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')
driver.get('https://www.baidu.com/')
driver.close()