selenium使用遇到的问题(selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.)

1.安装pip3 install selenium

2.使用browser=webdriver.Chrome()时报错 :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版本号(我的版本就是v66):

  2.然后根据自己的版本号下载相应版本的chromedriver.exe

    1.https://www.cnblogs.com/wangqianqiannb/p/8884168.html,可以在这个博客里面找自己的chrome版本对应的chromedriver版本

    2.http://chromedriver.storage.googleapis.com/index.html,在这个里面下载相应的包

  3.下载安装好后,复制路径,赋值给executable_path就OK了。

    browser=webdriver.Chrome(executable_path=r'D:杂七杂八chromedriver_win32chromedriver.exe')

 

  

  

原文地址:https://www.cnblogs.com/tangweijqxx/p/10789697.html