今天用谷歌浏览器爬取数据的时候,报了selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
这个异常
主要的原因还是因为selenium模拟的客户端对浏览器的操作,但相应浏览器的驱动版本不匹配导致的。
为了解决这个问题,我们需要先了解我们当前浏览器的版本。以小菌用的谷歌浏览器为例。
打开浏览器,在地址栏输入chrome://version/便可以查看到谷歌当前的版本号
接着我们来到谷歌浏览器驱动的下载网址http://chromedriver.storage.googleapis.com/index.html
选择我们谷歌浏览器的版本
选择相应的系统版本下载
解压把它放到两个路径下
1.谷歌的安装路径
2.python的安装路径
再在pycharm里执行相应的程序便得到了结果
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘的解决方法
最新推荐文章于 2024-03-18 15:48:59 发布