使用Selenium模块报错的解决办法FileNotFound,WebDriverException

发布时间:2020-07-30 19:09:25 作者:猫猫maomao
来源:网络 阅读:427

    添加Chrome浏览器程序的目录到系统Path变量中:

C:\Users\%USERNAME%\AppData\Local\Google\Chrome\Application ,使用pip3 install selenium安装selenium模块后,在jupyter notebook中运行示例程序:

from selenium import webdriver

browser = webdriver.Chrome()
browser.get('http://www.baidu.cn')

 

【报错信息】:

使用Selenium模块报错的解决办法FileNotFound,WebDriverException

使用Selenium模块报错的解决办法FileNotFound,WebDriverException

FileNotFoundError                         Traceback (most recent call last)

c:\users\catty\appdata\local\programs\python\python37\lib\site-packages\selenium\webdriver\common\service.py in start(self)

     75                                             stderr=self.log_file,

---> 76                                             stdin=PIPE)

     77         except TypeError:

 

FileNotFoundError: [WinError 2] 系统找不到指定的文件。
During handling of the above exception, another exception occurred:
WebDriverException                        Traceback (most recent call last)
<ipython-input-1-9c76fc9a65d6> in <module>
      1 from selenium import webdriver
      2
----> 3 browser = webdriver.Chrome()
      4 browser.get('http://www.baidu.cn')
      5
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home


 

【解决办法】:

到网址:http://npm.taobao.org/mirrors/chromedriver/

下载与浏览器程序Chrome.exe相对应的版本的chromedriver.exe 程序,放到系统能够找到的路径中,比如:C:\Users\catty\AppData\Local\Programs\Python\Python37目录下,再次在jupyter notebook中运行示例,不再报错,能够正常使用谷歌Chrome浏览器打开百度网站。

 

参考链接:

python Selenium2.0模块使用中报错的解决办法

https://blog.csdn.net/limeilian10221017/article/details/70570056

 

chromedriver.exe下载

https://blog.csdn.net/morling05/article/details/81094151

 

Chromedriver.exe 下载地址

http://npm.taobao.org/mirrors/chromedriver/73.0.3683.68/

http://npm.taobao.org/mirrors/chromedriver/

Mirror index of http://chromedriver.storage.googleapis.com/


推荐阅读:
  1. Selenium+Chrome 安装ChromeDriver时,报错
  2. scss中文报错解决办法

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

python selenium webdriver

上一篇:通过vs2010实现播放音乐

下一篇:oracle 查看实时SQL的CPU使用情况

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》