selenium調用webdriver異常

使用selenium調用webdriver的時候報錯。web

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

output:chrome

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

提示chromedriver須要加入環境變量。npm

查找chromedriver.exe未果,遂下載。google

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

貼心提示:  chromedriver須要與chrome版本對應3d

chrome版本查看方式 :幫助——關於 Google Chrome(G) code

 

 

使用方式:blog

  • 將chrome.exe直接放入chrome目錄下。
  • 將chrome.exe所在路徑加入環境變量。
相關文章
相關標籤/搜索