在使用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.先查看自己浏览器的版本

解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

 

 2.再去下载该版本对应的ChromeDriver驱动

下载地址:http://chromedriver.storage.googleapis.com/index.html

如果没有完全对应的版本,下载一个相近版本的驱动就可以了

解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

 

 

3.下载后解压到python安装的路径下,并加上如下代码

解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

from selenium import webdriver
chrome_drive = r"C:\Users\Administrator\AppData\Local\Programs\Python\Python37\chromedriver.exe"
self.dr = webdriver.Chrome(executable_path = chrome_drive)

 

这样再次运行就可以成功了

 

相关文章:

  • 2021-05-20
  • 2021-04-28
  • 2021-05-16
  • 2021-07-01
  • 2021-06-15
  • 2021-06-15
  • 2021-07-17
猜你喜欢
  • 2021-09-07
  • 2022-12-23
  • 2021-12-06
  • 2021-10-06
相关资源
相似解决方案