Python爬取网页遇到:selenium.common.exceptions.WebDriverException解决方法

2022/3/9 22:15:03

本文主要是介绍Python爬取网页遇到:selenium.common.exceptions.WebDriverException解决方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

在PyCharm中写好下列程序:

  一运行遇到下列报错:

selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
于是在网上搜索了一下最终解决了我的问题,在这里记录一下:

1.先在Chrome地址栏中输入:chrome://version/    查看浏览器的版本

2.进入网站:http://chromedriver.storage.googleapis.com/index.html  下载与自己浏览器相适配的driver

3.将下载好的压缩包解压后,将chromedriver.exe放在所写程序的目录中。

另:在网上还看到一种方法,但是对于我来说没有用(我也不清楚为啥没用),还是记录一下

将chromedriver.exe放在安装的selenium库下

 4.运行所写程序,就没有出错啦!



这篇关于Python爬取网页遇到:selenium.common.exceptions.WebDriverException解决方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程