執行 driver = webdriver.Firefox() 時,報錯如下:
原因:火狐瀏覽器安裝目錄下沒有geckodriver驅動
解決方法:
1、下載geckodriver驅動,放到Firefox安裝目錄下,如:C:\Program Files\Mozilla Firefox
2、然后把目錄路徑添加到系統環境變量path下
3、重啟腳本
安裝三大瀏覽器驅動driver
1.chromedriver 下載地址:https://code.google.com/p/chromedriver/downloads/list
或者:http://chromedriver.storage.googleapis.com/index.html
2.Firefox的驅動geckodriver 下載地址:https://github.com/mozilla/geckodriver/releases/
3.IE的驅動IEdriver 下載地址:http://www.nuget.org/packages/Selenium.WebDriver.IEDriver/