用 chrome 瀏覽器跑 selenium,執行以下腳本:
from selenium import webdriver
dr=webdriver.Chrome()
dr.maximize_window()
dr.get('http://www.baidu.com/')
報錯信息:WebDriverException: Message: 'chromedriver' executable needs to be in PATH
發現是 chromedriver.exe 文件放置的位置不對,我按網上查到的普遍 chrome 安裝路徑 C:\Program Files (x86)\Google\Chrome\Application,
並加入環境變量 PATH 中,但實際我的 chrome 安裝地址是 D:\Users\ma_jj\AppData\Local\Google\Chrome\Application
將放入該路徑下,並將該路徑加入到環境變量 PATH 中,問題得以解決。

可通過右鍵點擊chrome瀏覽器圖標-->屬性-->目標,獲取chrome的安裝目錄。
