一个使用selenium的爬虫脚本,运行时报错:
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable
needs to be in PATH. Please see
https://sites.google.com/a/chromium.org/chromedriver/home
这是因为缺少chrome驱动,安装上:
sudo apt-get install chromium-chromedriver
修改~/.bashrc,在最后加上export PATH=$PATH:/usr/lib/chromium-browser/
vim ~/.bashrc
export PATH=$PATH:/usr/lib/chromium-browser/
source ~/.bashrc
运行脚本然后报错:
selenium.common.exceptions.SessionNotCreatedException: Message: session not
created: This version of ChromeDriver only supports Chrome version 81
因为chromedriver版本与chrome版本不一致导致的,apt-get更新驱动发现更新不了最新版本