selenium调用webdriver异常

使用selenium调用webdriver的时候报错。

from selenium import webdriver

browser = webdriver.Chrome()
browser.get("http://www.baidu.com")
print(browser.page_source)
browser.close()

output:

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

提示chromedriver需要加入环境变量。

查找chromedriver.exe未果,遂下载。

下载地址:http://npm.taobao.org/mirrors/chromedriver/

贴心提示:  chromedriver需要与chrome版本对应

chrome版本查看方式 :帮助——关于 Google Chrome(G) 

 

 

使用方式:

  • 将chrome.exe直接放入chrome目录下。
  • 将chrome.exe所在路径加入环境变量。
posted @ 2018-06-21 22:16  locke_hu  阅读(619)  评论(0编辑  收藏  举报